Search code examples
teamcityintegrationcontinuous

Publish TeamCity artifacts. How to get Build IDs


I´ve created a Artifact path in TeamCity like this:

src\MyBuild\bin\Release\* => MyBuild.zip

Now I want to publish this created artifact through a download link:

http://localhost:8080/repository/downloadAll/BUILD_TYPE_ID/BUILD_ID:id?showAll=true

...But where I can get the BUILD_TYPE_ID and the BUILD_ID?


Solution

  • The documentation shows several different ways of getting to artifacts that might be easier.

    To help you along though, I believe BUILD_ID is the internal ID of a particular build but unfortunately I don't know how to get it. I do know though that you can substitute ".lastSuccessful" to get the last successful build. BUILD_TYPE_ID is the ID of the project you want artifacts for. You can find it by going to your team city page and clicking on that project. You should see a URL that looks like

    http://yourteamcity:8080/viewType.html?buildTypeId=bt1&tab=buildTypeStatusDiv

    See the "buildTypeId=bt1"? That bt1 is the BUILD_TYPE_ID (it is likely to be something other than bt1 on your machine).


    An example

    We use the following URL pattern to get at artifacts.

    http://yourteamcity:8080/repository/downloadAll/BUILD_TYPE_ID/BUILD_NUMBER

    It still uses the BUILD_TYPE_ID, but it uses BUILD_NUMBER instead of BUILD_ID. BUILD_NUMBER is visible on the TeamCity project page.

    So for us an example link to get build number 312.4 would look as follows -

    http://yourteamcity:8080/repository/downloadAll/bt1/312.4

    Your numbering scheme may be very different.