Hello there,
I would like to understand if it is possible to add wait time between concurrent builds please.
Basically I have a Bamboo plan with three agents dedicated to the plan and the concurrent build is set to 3.
Let say a build is executing on one agent, the build on the next agent should start after X mins of the first build and likewise the build on three agent should initiate after the X mins of second build.
Let me know if my statement is not clear.
Thank you!
Hello @Rajib Dey,
Welcome to Atlassian Community!
There is no such feature in Bamboo. You can work around that by using a script task that will put a delay on the initial job execution.
You will need a common filesystem mounted on all Bamboo agents. This is mandatory so they can communicate and decide on the job execution order.
The following script needs to run as the first task in a Job. It will check if the control file exists, if so it will ask for a file lock. Make sure your NFS/CIFS/Clustered filesystem implementation allows file locking.
If a lock is granted, then it will proceed with some extra checking that will decide if it needs further sleep for X amount of seconds before exiting, but only if the current control file timestamp is lower than the sleep time.
#!/bin/bash
# time in seconds
wait_time=20
# this file should be in a NFS/CIFS share where all agents can write to
control_file=/tmp/job_control
curr_time=$(date +%s)
if [ ! -f ${control_file} ] ; then
touch ${control_file}
else
control_file_time=$(stat --format=%Y ${control_file})
exec 100>${control_file}.lock
if flock 100; then
sleep_time=$(( $curr_time - $control_file_time ))
if [ $sleep_time -lt ${wait_time} ]; then
sleep $(( ${wait_time} - ${sleep_time} ))
fi
fi
echo "Run at second: $(date +%S.%N)"
touch ${control_file}
fi
This is just an example which you can adapt to your needs. It will work in Linux, in Windows you can use PowerShell to achieve similar behaviour.
Regards,
Eduardo Alvarenga
Atlassian Support APAC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.