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:
To download artifacts by the build ID, use:
To download artifacts by the build number, use:
To download artifacts from the latest build with a specific tag, use:
To download all artifacts in a .zip archive, use:
where
BUILD_TYPE_EXT_ID
is a build configuration ID.BUILD_SPECIFICATION
can be.lastFinished
,.lastSuccessful
or.lastPinned
, specificbuildNumber
or build ID in formatBUILD_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:
BUILD_TYPE_EXT_ID
is a build configuration ID.BUILD_SPECIFICATION
can be.lastFinished
,.lastPinned
,.lastSuccessful
, specificbuildNumber
or build ID in formatBUILD_ID:id
.PATH_WITHIN_ARCHIVE
is a path to a file within azip/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):
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 addedguest=1
parameter. For example:/repository/download/BUILD_TYPE_EXT_ID/.lastFinished/ARTIFACT_PATH?guest=1Add the
/guestAuth
prefix to the URLs, instead of usingguest=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: