Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how do I know how my build plan was triggered: manually or automatically (night)?

e June 30, 2014

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.

3 answers

1 accepted

1 vote
Answer accepted
Jason Monsorno
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2014
${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


1 vote
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2014
e June 30, 2014

All right, if it's not a variable, then how can I know if the build was triggered manually?

rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 1, 2014

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:

&lt;!-- Initial build --&gt;
&lt;buildReason&gt;First build for this plan&lt;/buildReason&gt;
&lt;!-- Manual build --&gt;
&lt;buildReason&gt;
Manual run by &lt;a href="http://BAMBOO-BASEURL/browse/user/admin"&gt;Administrator&lt;/a&gt;
&lt;/buildReason&gt;
&lt;!-- WebHooks --&gt;
&lt;buildReason&gt;
Changes by &lt;a href="http://BAMBOO-BASEURL/browse/user/admin"&gt;Administrator&lt;/a&gt;
&lt;/buildReason&gt;
&lt;!-- Scheduled --&gt;
&lt;buildReason&gt;Scheduled&lt;/buildReason&gt;
&lt;!-- Dependency (Child of) --&gt;
&lt;buildReason&gt;
Child of &lt;a href="http://BAMBOO-BASEURL/browse/PROJECTKEY-PLANKEY-BUILDNUMBER"&gt;PROJECTKEY-PLANKEY-BUILDNUMBER&lt;/a&gt;
&lt;/buildReason&gt;

Kind regards,
Rafael

0 votes
e July 1, 2014

Thanks a lot!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events