Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Run Bamboo Plan branch just once Edited

We have a Bamboo plan set up to create plan branches that is triggered whenever is new feature branch is created in Bitbucket (it is set up to monitor Bitbucket). We only want that plan to be executed once (when a feature branch is created) because it is used to create an sfdx scratch org.

However, the problem is that Bamboo kicks off the branch plan whenever a change is committed to the feature branch. How do we turn that off?

Thanks,

Jozef 

 

3 answers

1 accepted

Hi @Jozef Vandenmooter , 

we can achieve the above requirement in the following way.

  • Add the Bitbucket Server repository triggered trigger in the plan configuration and disable it in the Plan Configuration
  • In the Branches under plan configuration, select the option same as defined in the parent plan for Branch triggers option.
  • Configuring the plan configuration with the above steps will meet the requirements.

Please let me know if you need any other help :)

Thanks, 

Poorna

Works great - thanks Poorna! 

Jozef  

I haven't actually verified this myself, but am confident that you can achieve this with the Conditional tasks for Bamboo app, which allows you to Control task execution by variables and as a use case specifically references that you can Skip build steps in plan branches.

Given that each branch starts with build number 1, you should be able to use the resp. Bamboo variable ${bamboo.buildNumber} and skip the task if it doesn't match.

You can find more details about this app in @Daniel Santos' excellent answer to How we can configure job with conditional tasks for bamboo Plug-in?

As Daniel emphasizes, the app is currently listed as unsupported under Atlassian Labs, but given its importance and success, and how this has been handled in the past, I'm fairly optimistic that Atlassian will at least maintain it, and maybe even promote it to a built-in Bamboo feature down the road. Please watch and vote for the following issue to further increase Atlassian's priority for an official solution regarding this highly voted feature request:

Hi Steffen,

Thanks for the reply. That looks like an awesome plugin indeed.

 

However, wouldn't the plan still kick off and create a log even if the Tasks are not executed? As I said, we don't want the plan to be kicked off at all anymore once the initial run created the sfdx scratch org.

Jozef  

Like Steffen Opel _Utoolity_ likes this

Hey @Jozef Vandenmooter
I just want to add another idea as a second option.

You could configure the plan branch to disable itself when it runs for the first time. For this, you would need to create a script task at the end of your build with a bash script like:

# If this is not the main plan branch
if [ ${bamboo.planRepository.1.branch} != '<DEFULT_SOURCE_REPOSITORY_BRANCH>' ]
then
# Disable this plan branch
curl -k -u <USER>:<PASSWORD> -H "Content-type: application/json" -X DELETE <BAMBOO_URL>/rest/api/latest/plan/${bamboo.planKey}/enable
fi

The problem with this approach is that you will need to have credentials in your build in order to run the rest API to disable the plan. You can add them as password variables, but they would still be available in your build.

I would stick with @Steffen Opel _Utoolity_'s option if you want to avoid some of the build tasks but still want to run the build for the plan branch.

Like # people like this

I wrote the message above without seeing your last response... I guess it still applies to it =]

Like Jozef Vandenmooter likes this

I believe you :)

Thanks a bunch! 

Jozef 

Like Daniel Santos likes this

Hi Jozef,

Your question about a skipped task still being logged has been implicitly answered by @Daniel Santos I guess, that's indeed the case - his clever solution is spot on accordingly (see PS for an alternative that avoids the credentials issue)!

Out of curiosity, may I ask why the logs are an issue? Incidentally the resp. extension point for a Build Trigger Condition module actually fulfills your requirement, i.e. "A build which fails the trigger condition will not be executed, there will be no trace of the existence of this build".

However, we (Utoolity) have a backlog story for our Automation with AWS (Bamboo) app to implement such a build trigger condition that will call out to AWS Lambda, but the users we have talked about this so far always want to have some trace regardless, which renders the story considerably more complex for us because we'd need an audit log.

Thanks,
Steffen

PS: Btw., if you happen to use AWS and do not want to make the credentials available to your build, you could use our (commercial) Invoke Lambda Function action to interact with the Bamboo REST API remotely, which means you can securely store the required Bamboo credentials in the Systems Manager Parameter Store.

Like Daniel Santos likes this

Thank you, @Steffen Opel _Utoolity_, for adding an option to securely store the credentials.

Hello. There's much simpler solution to run only first build of new branch. It's possible to configure triggers for new plan branches. Go to Plan configuration -> Branches. Then choose None trigger. Bamboo will create new branch, run initial build and then do nothing.

Screenshot 2019-06-24 at 12.17.17.png

Update. My mistake. It doesn't work. Branch is created, but first build is not executed.

Right - that was the first thing I tried  :)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

191 views 4 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you