Hi
Is there a way to get the build number of another plan?
Would be best if I could just reference it as a bamboo variable in my current plan, not with an REST API call, just like TEAMCITY.
https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html
Thanks.
Hello Niko,
I have the impression that it can only be achieved in TeamCity when using a snapshot dependency (Using the Build Number of another Configuration – TeamCity Support).
I'm not sure if this is the same idea (I don't work with TeamCity), but in Bamboo we have the plan build dependencies (Setting up plan build dependencies - Atlassian Documentation) to set relationship between plans. Although we have that, variables cannot be passed from parent plans to child plans. We have a feature request to improve that ([BAM-3175] In order to have pass control to child build plans, Bamboo should have an option of passing variables between parent and child builds), but there is a workaround you can use.
If your plans have a dependency relationship you can do this:
echo "planKey="${bamboo.planKey} >> variablesecho "buildNumber="${bamboo.buildNumber} >> variables
The process above can be used to get any variables from the parent plan and publish them in the child plan.
You can also:
SELECT MAX(BUILD_NUMBER) FROM BUILDRESULTSUMMARY WHERE BUILD_KEY='<PLAN-KEY>'
<Bamboo_URL>/rest/api/latest/result/<PROJ-KEY>-latest
Linux example:
curl -u <USER>:<PASSWORD> -X GET '<Bamboo_URL>/rest/api/latest/result/<PROJ-KEY>-latest' | awk -v FS="(resultNumber)" '{print $2}' | tr -d '<>/'
I hope it helps.
Hi Daniel
Thanks for the reply. We actually implemented the solution you mentioned, exposing the build number as an artefact.
Glad to know that there is a feature request opened as this is a very useful function to have.
I have written a guide for others who might be interested.
https://medium.com/@niko.wah.hn/how-to-share-build-number-between-plans-in-bamboo-ci-f708d55483f1
Hi Niko,
I'm glad to know you already implemented it and thank you so much for writing the article and sharing it here =]
It looks like you're new here. Sign in or register to get started.