TeamCity 8.0 Help

Patterns For Accessing Build Artifacts

If you need to access the artifacts in your builds, consider using TeamCity's built-in Dependent Build feature.

This section covers URL patterns that you may use to download build artifacts from outside of TeamCity. Please consider using REST API which provides more rich build selection facilities and allows for artifacts listing. The other URLs described below are mostly preserved for backward-compatibility with previous TeamCity versions and for some specific functionality.

You may also download artifacts from TeamCity using Artifact Dependencies dependency manager.

See also Accessing Server by HTTP on basic rules covering 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 Working with Build Results, use:

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

To download artifacts by build number, use:

/repository/download/BUILD_TYPE_EXT_ID/BUILD_NUMBER/ARTIFACT_PATH

To download artifacts from last build with 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 Configuring General Settings.

  • BUILD_SPECIFICATION can be .lastFinished, .lastSuccessful or .lastPinned, specific buildNumber or Working with Build Results in format BUILD_ID:id.

  • ARTIFACT_PATH is a path to artifact on TeamCity server. This path may contain a {build.number} pattern which will be replaced with build number of the build whose artifact is retrieved. By default, archive with all artifacts does not include Build Artifact. To include them, add "?showAll=true" to 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 "?branch=<branch_name>" parameter to the end of the corresponding URL.

Obtaining Artifacts from an Archive

TeamCity allows to obtain 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 Configuring General Settings.

  • BUILD_SPECIFICATION can be .lastFinished, .lastPinned, .lastSuccessful, specific buildNumber or Working with Build Results in format BUILD_ID:id.

  • PATH_WITHIN_ARCHIVE is a path to a file within an zip/jar/tar.gz archive on TeamCity server.

Following archive types are supported (case insensitive):

  • .zip

  • .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 accessing artifacts repository.

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

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

Basic authentication is required for accessing artifacts by this URLs with /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 /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.

You can use {build.number} as a shortcut to current build number in the artifact file name. For example:

http://teamcity.yourdomain.com/repository/download/MyConfExtId/.lastFinished/TeamCity-{build.number}.exe

Last modified: 20 April 2023