Queue build in all compatible agents using REST

 Hi,

 

I see that there are two ways of queuing a build in TEamcity.

1.

http://user:password@teamcity:8111/httpAuth/action.html?add2Queue=MyBuildConf&agentId=allEnabledCompatible

2. Send a POST request to following with the build node in content

http://tcsvr/app/rest/buildQueue

 

So far I've been able to queue build successfully the second way, whereas in the first one I get this error that 'agentId' is not recognized as an internal or external command, operable program or batch file. I also noticed that in older TC versions (e.g. 9.1.7), even after getting this agentId message, build would still get queued. But now in the 2017.2.3 version it doesn't work anymore.

Question about the second method - can you queue builds on all compatible agents or in a specific agent using the second method?

Also is the first approach documented anywhere?

0
2 comments

Hi,

The "action.html" was an old endpoint we used before our REST API was properly formed. It's now obsolete, we just haven't added that to the documentation. The REST API should always be used.

Queuing on a specific agent is explained in the examples for the rest api: https://confluence.jetbrains.com/display/TCD18/REST+API#RESTAPI-TriggeringaBuild

While we don't offer a direct way to trigger through the REST on all agents, it should be simple to retrieve the list of compatible agents for a given build, then send a single build to each specific agent. This should be done with care, though, as it will make all agents be busy which would stop other builds from running during that time

0

Hi Denis,

 

Thanks for your reply. One thing I noticed is that method 1 is still working actually! I think my issue at that time was forming the string correctly to pass to wget. Obviously I ended up using this method 1 in the end since its just a one-liner to queue builds in all agents. Do you recommend continuing to use this action.html endpoint still though in case it goes away in the future?

 

Thx

Munawar

0

Please sign in to leave a comment.