Modify agent requirements in build chain
I have a build chain that creates a cloud profile at start of the build, what I want to do is set an agent requirement for that cloud agent in a later build of the build chain.
My chain is like this:
Build Image (to be used in cloud profile) > Create Cloud Profile > Set Agent Requiement > Run Tests On Image > Delete Cloud Profile
In the "Set Agent Requiement" step I am able to set an agent requirement for "Run Tests" step, however that requirement is not immediately used. For example I set the requirement "teamcity.agent.hostname" for "Run Tests" step and I can see the requirement, but during the build "teamcity.agent.hostname" still has the old value.
So my question is, is there anyway to set agent requirement during the chain running?
Please sign in to leave a comment.
Hi Robert,
I'm afraid this isn't strictly possible this way. Once a build is added to the queue, its agent requirements are set, and once a build queue is triggered, all of its builds are added into the queue. This obviously means that a build chain cannot modify its agent requirements once it begins.
The workaround here would be to separate the chain, break it on the snapshot dependencies where the requirements are set. Then you could either set a finish build trigger, or set a last build step that triggers the rest of the chain via the REST API. Could you check whether this would work for you.
Thanks a lot Denis Lapuente. I figured out the agent-requirement after I posted here. I ended up using the REST API to trigger another chain, it works quite well. I have also tested with snapshot dependencies as per your suggestion that works very well too.
Thanks again for the help.