Patterns For Accessing Build Artifacts
Last modified: 20 April 2023Obtaining artifacts
Use the following patterns to download artifacts:
To download artifacts of the latest builds (last finished, successful or pinned) use the following paths:
/repository/download/BUILD_TYPE_ID/.lastFinished/ARTIFACT_PATH /repository/download/BUILD_TYPE_ID/.lastSuccessful/ARTIFACT_PATH /repository/download/BUILD_TYPE_ID/.lastPinned/ARTIFACT_PATH
To download artifacts by build id use this path:
/repository/download/BUILD_TYPE_ID/BUILD_ID:id/ARTIFACT_PATH
To download artifacts by build number the following path should be used:
/repository/download/BUILD_TYPE_ID/BUILD_NUMBER/ARTIFACT_PATH
where
BUILD_TYPE_ID is a build configuration ID
BUILD_NUMBER is a build number
BUILD_ID is a build ID
ARTIFACT_PATH is a path to artifact in TeamCity server.
Obtaining artifacts from an archive
TeamCity allows to obtain a file from any zip/jar archive from the build artifacts directory, using one of the following URL patterns:
Pattern 1
/repository/archive/<zip or jar archive>/buildTypeId/BUILD_TYPE_ID/buildId/(lastFinished|lastSuccessful|lastPinned)/index.html
where:
BUILD_TYPE_ID is a build configuration ID
lastFinished | lastSuccessful | lastPinned is an identifier for the build instance
Pattern 2
/repository/archive/<zip or jar archive>/buildTypeId/BUILD_TYPE_ID/buildNumber/BUILD_NUMBER/index.html
where
BUILD_TYPE_ID is a build configuration ID
BUILD_NUMBER is a build number
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. In TeamCity prior to version 2.1 you can download artifacts with such tools without any authentication.
Since 2.1 TeamCity started to ask for authentication if you accessing artifacts repository. To authenticate correctly from a build script URLs should be changed (prefix /httpAuth/ should be added to the URL):
/httpAuth/repository/download/BUILD_TYPE_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.
Another approach is to enable guest login. In this case you can use old URLs withour /httpAuth/ prefix but you should add guest=1 parameter to the URL:
/repository/download/BUILD_TYPE_ID/.lastFinished/ARTIFACT_PATH?guest=1
Since 2.1.1 you can avoid using guest parameter. The artifact when guest is enabled can be downloaded using the following URL:
/guestAuth/repository/download/BUILD_TYPE_ID/.lastFinished/ARTIFACT_PATH
I.e. guest=1 parameter can be replaced with /guestAuth prefix.
You will not be asked for authentication in this case.
Thanks for your feedback!