Pinning and Tagging builds automatically?
Is it possible to 'automatically' tag or pin a build in teamcity (without manually using the webinterface) - perhaps using build service messages or via a teamcity URL? Please note I want to add Teamcity tags, I'm not talking about labelling the source in the source control system.
Thanks,
Jamie.
Please sign in to leave a comment.
Use the following URL for tagging:
/httpAuth/ajax.html?editTagsForBuild=<build id>&buildTagsInfo=<comma separated tags>
And the following URL for pinning + tagging:
/httpAuth/ajax.html?pin=true&buildId=<build id>&buildTagsInfo=<comma separated tags>&pinComment=<optional comment>
buildTagsInfo & pinComment parameters are optional.
Note that these requests are undocumented and may change in the future.
Thanks for the prompt response. The first one (tagging only) works fine if I change action.html to ajax.html, but the second one (pinning) doesn't seem to work (though I do get an empty <response/> tag back in the XML). Does it apply to a specific version of TeamCity? We are on 4.5.1.
What url do you use? The urls I described are for TeamCity 4.5, however I think they should work with 4.0 too.
For pinning I tried the following two:
http://machine:81/httpAuth/ajax.html?pin=true&buildld=20762
http://machine:81/httpAuth/ajax.html?pin=true&buildld=20762&buildTagsInfo=test_tags&pinComment=thisisacomment
Both produce an empty response tag (as for the successful commenting) but the pin doesn't seem to apply.
It seems I made a mistake in 'buildId' param name (I used L in lower case instead of I in upper case). Please change this parameter name and try again.
That works great - thanks.
Hi,
I just opened this feature request: please vote for it if you find it useful:
https://youtrack.jetbrains.com/issue/TW-38017
I'm able to see how we can use the API to call setting tags for a particular build. I'm not sure how you were using that to automatically tag a build.
Are you making the API call in a buildstep?
Hi Marcel,
Yes, currently there is no automatic method for tagging or pinning within the workflow, so you need to have a build step that will do it using the API, typically a command line script.
Denis, can you pleas provide some idea how to create such pin script that can be invoked from build step?
Hi Yevgeniy,
We have our docs here with examples and the URLs that should be requested: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-BuildTags