How to assing project to build agent pool using API?

Hi all,

I'm trying to automate our collaboration with TeamCity and resently faced a problem. I can create projects, build templates, build configurations, set all required parameters using REST API. Also I can trigger builds, but all of them fail because they are linked with default agent pool. I need to use another build pool, so I tried to find some way to assign projects (or build configurations) to spesific agent pools, but I cannot see such functionality in REST API service description and TeamCity documentation. Search for solution on this site did not provide any results.

So I came here and I'm asking community to help me. Is there any way to automate assigning of projects to agent pools using some API?

Thanks

7 comments
Comment actions Permalink

Hey, gurus of TC! Please help with my question

0
Comment actions Permalink

At the moment our REST API does not provide such functionality. We have this feature request in
TW-26495, please vote.

As workaround you can send direct HTTP requests to the server emulating usual form filling and button clicks.
For example, to add a project to a agent pool, send POST-request to http://teamcity/agentPools.html with content like

action=ConfigureProjectsAction&pool=2&associatedProject=project8



Pool IDs are not displayed in UI, but you can find it at Agent Summary page, in the URL of a link to agent's pool page.
0
Comment actions Permalink

"action=ConfigureProjectsAction&pool=2&associatedProject=project8"

I was able to use the above for moving projects between pools. However -- Is there a post syntax we can use to move agents between pools instead?

I would like to keep the pools consistent and move the agents between pools, allowing agents to handle different project loads based on normal business hours vs. after hours.

--
Message was edited by: Mickey Frklic -- Fixed formatting

0
Comment actions Permalink
Anyone able to help with the above request?
0
Comment actions Permalink

Really hoping there is an HTTP POST syntax we can use to move an agent to another pool as needed. Seems like if you could move projects, agents would be just as easy.

Any help with this would be greatly appreciated.

0
Comment actions Permalink

+1, specifically for moving an agent to another pool.

I tried to spoof the popup with curl GET/POST, but it requires a session, which I'm not sure how to spoof.

0
Comment actions Permalink

I added the curl -c and -b options to maintain a jar of cookies, and my journey towards the dark side was complete.

0

Please sign in to leave a comment.