How to delay a build step agentlessly?
Build step A -> wait 10 minutes -> Build step B
I know I can use a CMD script to sleep 10 minutes on an agent, but that will make that agent occupied for 10 minutes, just for waiting?!
Why can't we just wait on TeamCity server since there are already similar things like execution timeout?
I think currently there is a way to achieve this with "agentless build step" and execution timeout, but it's still to complicated:
A: Create a "wait" build step, set timeout to 10 minutes, and use a script to detach from agent;
or B: Create a "wait" build step, use a script to detach from agent, sleep 10 minutes, and send a REST message to finish the build.
For A, the wait step will be marked as "Failed" because of the timeout - we don't want this.
For B, we have to write account/password or API token in the script - we don't want this, either.
I hope there could be an "agentless wait" feature.
Please sign in to leave a comment.
Hello,
What would be a use case for this scenario? This approach of detaching the agent during the waiting period also could lead into problems if the Build Step B needs resources from the build working directory generated by previous build steps and the build is picked up by another agent. Maybe the following feature request could work for you?
https://youtrack.jetbrains.com/issue/TW-11912/Ability-to-pause-starting-of-new-builds-by-schedule-and-manually
Thank you,
Guilherme
Guilherme Barbosa Thanks for the response, I have achieved the approach B since I realized there are disposable `system.teamcity.auth.userId` and `system.teamcity.auth.password`. It works well so far.
The case is kind of complicated to explain. In brief, we upload some data to a remote server in step A. The server processes data every 5 minutes so we wait for 10 minutes. Then we download the processed result in step B.
Since we don't have many agents, I'd like to prevent agents waste time on waiting, and let them pick up the job as soon as possible after 10 minutes.