Hello, I am using Bamboo 5.4.2
How do I know how my build plan was triggered: manually or automatically (night)?
I want to write a script that will react accordingly, depending on whether the build was started manually or automatically (scheduled).
I expect there to be some kind of a variable like ${bamboo.triggered.by}, which sets to "manually", "scheduled", "child".
Please advise.
${bamboo.ManualBuildTriggerReason.userName}
It's only populated on manual builds but can be used as a flag in a script or something.
https://confluence.atlassian.com/display/BAMBOO/Bamboo+variables
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Thank you for your question.
You could use the follwing REST API call:
# URI result/PROJECTKEY-PLANKEY # (where PROJECTKEY-PLANKEY is the key of the desired build plan of a project, e.g. MYPROJ1-MYPLAN1) http://<bamboo-baseURL>/rest/api/latest/result/MYPROJ1-MYPLAN1?expand=results.result.buildReason
Please, refer to Bamboo REST Resources for further information.
In the XML response, please search for the <buildReason/> tag. You might find the follwing:
<!-- Initial build --> <buildReason>First build for this plan</buildReason>
<!-- Manual build --> <buildReason> Manual run by <a href="http://BAMBOO-BASEURL/browse/user/admin">Administrator</a> </buildReason>
<!-- WebHooks --> <buildReason> Changes by <a href="http://BAMBOO-BASEURL/browse/user/admin">Administrator</a> </buildReason>
<!-- Scheduled --> <buildReason>Scheduled</buildReason>
<!-- Dependency (Child of) --> <buildReason> Child of <a href="http://BAMBOO-BASEURL/browse/PROJECTKEY-PLANKEY-BUILDNUMBER">PROJECTKEY-PLANKEY-BUILDNUMBER</a> </buildReason>
Kind regards,
Rafael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.