TeamCity Cloud 2023.07 Help

Patterns for Accessing Build Artifacts

This section is preserved for backward compatibility with the previous TeamCity versions and for some specific functionality.

Check the following information as well:

  • If you need to access the artifacts in your builds, consider using the TeamCity's built-in artifact dependency functionality.

  • You can also download artifacts from TeamCity using the Ivy dependency manager.

  • For artifact downloads from outside TeamCity builds, consider using REST API.

  • See also Accessing Server by HTTP on basic rules covering an HTTP access from scripts.

Obtaining Artifacts

To download artifacts of the latest builds (last finished, successful or pinned), use the following paths:

/repository/download/BUILD_TYPE_EXT_ID/.lastFinished/ARTIFACT_PATH /repository/download/BUILD_TYPE_EXT_ID/.lastSuccessful/ARTIFACT_PATH /repository/download/BUILD_TYPE_EXT_ID/.lastPinned/ARTIFACT_PATH

To download artifacts by the build ID, use:

/repository/download/BUILD_TYPE_EXT_ID/BUILD_ID:id/ARTIFACT_PATH

To download artifacts by the build number, use:

/repository/download/BUILD_TYPE_EXT_ID/BUILD_NUMBER/ARTIFACT_PATH

To download artifacts from the latest build with a specific tag, use:

/repository/download/BUILD_TYPE_EXT_ID/BUILD_TAG.tcbuildtag/ARTIFACT_PATH

To download all artifacts in a .zip archive, use:

/repository/downloadAll/BUILD_TYPE_EXT_ID/BUILD_SPECIFICATION

where

  • BUILD_TYPE_EXT_ID is a build configuration ID.

  • BUILD_SPECIFICATION can be .lastFinished, .lastSuccessful or .lastPinned, specific buildNumber or build ID in format BUILD_ID:id.

  • ARTIFACT_PATH is a path to the artifact on the TeamCity server. This path can contain a {build.number} pattern (%7Bbuild.number%7D) which will be replaced by TeamCity with the build number of the build whose artifact is retrieved. By default, the archive with all artifacts does not include hidden artifact. To include them, add ?showAll=true at the end of the corresponding URL.
    To download artifact from the last finished, last successful, last pinned or tagged build in a specific branch, add the ?branch=<branch_name> parameter at the end of the corresponding URL. If the branch parameter is not specified, the artifact is downloaded from a build in the default branch.

Obtaining Artifacts from an Archive

TeamCity allows obtaining a file from an archive from the build artifacts directory by means of the following URL patterns:

/repository/download/BUILD_TYPE_EXT_ID/BUILD_SPECIFICATION/<archive>!/PATH_WITHIN_ARCHIVE
  • BUILD_TYPE_EXT_ID is a build configuration ID.

  • BUILD_SPECIFICATION can be .lastFinished, .lastPinned, .lastSuccessful, specific buildNumber or build ID in format BUILD_ID:id.

  • PATH_WITHIN_ARCHIVE is a path to a file within a zip/7-zip/jar/tar.gz archive on TeamCity server. Following archive types are supported (case-insensitive):

  • .zip

  • .7z

  • .jar

  • .war

  • .ear

  • .nupkg

  • .sit

  • .apk

  • .tar.gz

  • .tgz

  • .tar.gzip

  • .tar

Obtaining Artifacts from a Build Script

It is often required to download artifacts of some build configuration by tools like wget or another downloader which does not support HTML login page. TeamCity asks for authentication if you access the artifacts' repository.

To authenticate correctly using token-based auth from a build script, you have to pass your personal access token in the HTTP header Authorization: Bearer <token-value>.

To authenticate correctly using basic auth from a build script, you have to change URLs (add the /httpAuth/ prefix to the URL):

/httpAuth/repository/download/BUILD_TYPE_EXT_ID/.lastFinished/ARTIFACT_PATH

Basic authentication is required for accessing artifacts by these URLs with the /httpAuth/ prefix.

You can use existing TeamCity username and password in basic authentication settings, but consider using teamcity.auth.userId/teamcity.auth.password system properties as credentials for the download artifacts request: this way TeamCity will have a way to record that one build used artifacts of another and will display that on build's Dependencies tab.

To enable downloading an artifact with guest user login, you can use either of the following methods:

  • Use old URLs without the /httpAuth/ prefix, but with added guest=1 parameter. For example:

    /repository/download/BUILD_TYPE_EXT_ID/.lastFinished/ARTIFACT_PATH?guest=1
  • Add the /guestAuth prefix to the URLs, instead of using guest=1 parameter. For example:

    /guestAuth/repository/download/BUILD_TYPE_EXT_ID/.lastFinished/ARTIFACT_PATH

In this case, you will not be asked for authentication. The list of the artifacts can be found in /repository/download/BUILD_TYPE_EXT_ID/.lastFinished/teamcity-ivy.xml.

Links to the Artifacts Containing the TeamCity Build Number

You can use {build.number} (%7Bbuild.number%7D in URL) as a shortcut to current build number in the artifact file name. For example:

http://teamcity.yourdomain.com/repository/download/MyConfExtId/.lastFinished/TeamCity-%7Bbuild.number%7D.exe
Last modified: 14 July 2022