How to : Get artifacts from server in script

Hi, I'm using TC 4.0.2 and I have some projects that generate artifacts.
Those are libs that are needed by other developpers. I'm trying to figure out how to allow them to get thoses libs.
Artifacts can be retrieve using url (, but they need to be download 1 by 1 and some of my artifacts directories contains 300+ files . Next TC release will add a "download all" feature ( but its future...
I can also share the server artifacts directory, which is a good solution for me, but the structure is <TeamCity Data Directory>/artifacts/<project name>/<build configuration name>/<internal_build_id>. Now if I'm using a script (.bat), how can I translate .lastSuccessfull build to internal_build_id ?? In other words, how can I wrote a script that will return all the files inside the last successful dir or how can I get the "last" internal_build_id to put in a script?


Comment actions Permalink

I'm also thinking about creating a dependent build that will only be used to move the artifacts to another location.
But that will create extra builds and i'll need to give the agents access to the target destination which may be tricky because they currently run as a service in system account.

Comment actions Permalink


   I suppose that making such a 'deployment' configuration may be a way to go. You can specify any user account to run build agent under,
   and you can create aggressive cleanup policy to delete such unneeded deployment build.
  The only problem is that you can't deploy artifacts to a network share, if build agent runs as a windows service.

   We plan to add a feature which would allow to create post- and pre- build steps to build configurations:

   Alternatively, you can use Ivy to access artifacts from external scripts (even if they are run outside of TeamCity):

  Hope this helps,

P.S. Unfortunately, there is no HTTP API to obtain internal build_id for last successful build.

Comment actions Permalink

Ok, I have vote for that issue, which may be very usefull. Other CI server have that abilities to run post/pre build script.
Well I guess I will have to parse some grep result to determine the last build artifact directory.
If someone already have a solution like that, feel free to post.


Please sign in to leave a comment.