Use REST API to get artifact name

I wrote too much so I'm prefacing this with the simple question: How do I query the REST API to get the artifact names for a given build?

I'm adapting a current build/deploy process from CC.net to TeamCity and am stumbling a bit on getting the artifacts to my deploy script.

The scenario is currently a manual deploy using a script that takes an environment file to determine where to deploy. The first thing it does is go and grab the latest, or optionally specified revision, package then prompt the user to verify and deploy to N machines as needed.

With CC.Net the artifacts all lived on the filesystem (build box is deploy box, for now) and I just searched that drive for either the latest package or a package containing the rev number. Now with TeamCity I no longer have the ability to just search the filesystem, which is fine, but the problem is the artifact filename (a .7z archive) contains a timestamp and I don't know what the filename is.

I messed around with the REST API and I like that I can query for build information, I envision the user prompt now being a sort of picklist of builds with the default being 'last successful'. However, I can't seem to find a way to list the artifact filenames and thus cannot download the artifact directly. I did figure out how to download 'all artifacts in a zip file' but since my artifact is already an archive that means I now have to unpack twice during deployment.

thanks,
Paul

2 comments
Comment actions Permalink

Hi Paul

Not by REST, but you can obtain this list from http://<host>/repository/download/<BUILD_TYPE_ID>/.lastFinished/teamcity-ivy.xml

0
Comment actions Permalink

Thank you, this is exactly what I need.

For reference I want to be able to pick a specific build, so the following pattern works:

http://<host>/repository/download/<BUILD_TYPE_ID>/<BUILD_REVISION>/teamcity-ivy.xml

Seeing the Ivy filename jogged my memory and I was able to find some related docs here:

http://confluence.jetbrains.net/display/TCD65/Artifact+Dependencies#ArtifactDependencies-ConfiguringArtifactDependenciesUsingAntBuildScript

0

Please sign in to leave a comment.