Details
-
Bug
-
Resolution: Fixed
-
Medium
-
5.6.2
-
None
-
None
Description
Reported by customer on 5.6.2:
Steps to reproduce:
1) create a new plan
2) in plan configuration -> Variables tab: add a new variable
Variable name: my_var
Value: true
3) in the default job add a bash script with the following:
coin_flip=$(( ( RANDOM % 2 ) + 1 ))
echo "Number is.....: $coin_flip"
if [ $((coin_flip%2)) -eq 0 ]; then
echo "even number. pass the build."
echo "my_var is....: $bamboo_my_var"
exit 0
else
echo "odd number. lets error"
exit 1
fi
4) create a related deployment job.
5) add a environment (prod)
6) in edit tasks add a bash script with the following.
if [ -z "$bamboo_my_var" ]; then
echo "my_var is not set!"
echo "looks like a retry build being deployed bug!"
exit 1
else
echo "all good!"
echo "my_var is set to: $bamboo_my_var"
echo "Lucky the build being deployed wasnt a build which has retry!"
exit 0
fi
7) now run a build till you get a failed build.
8) once you get a failed build run retry failed/incompleted jobs only
run that till it passes.
9) go to the deployment for that project.
select deploy -> prod
select create new release from build result.
select the last build (which was a retried build)
click start deploy.
you will notice the bamboo_my_var value not being set.
and the deploy will fail.
if you do the same for a successful build which wasnt a retry you will get your custom variable and it will exit correctly.
I was able to reproduce this on Bamboo 5.7 as well