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

How to disable build trigger with new branch creation

ananda3 October 6, 2022

After bamboo spec enablement for repo, any time someone creates a branch on the server, it immediately triggers a build. Even without any commits or code changes. Can we avoid building until an initial commit is pushed?

Before, Bamboo Spec enablement this was working as expected.

1 answer

0 votes
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2022

Hello @ananda3

Welcome to Atlassian Community!

You can disable automatic branch creation by modifying the Plan settings under Branches:

Create plan branch
( ) Manually
( ) When a pull request is created
( ) When new branch in repository is created
( ) When new branch in repositoru is created and matches expression


Sincerely,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

ananda3 October 6, 2022

@Eduardo Alvarenga 

I think this is not matching with the problem statement, we want to have new branch created but don't want to trigger the build with just new branch creation. We want build to be triggered when there is a commit in the created branch.

Currently, whenever a branch is getting created, it triggers the build in that plan branch.

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 7, 2022

Hello @ananda3

Thank you for providing more details on your request.

Bamboo will trigger a build by default on a Plan Branch creation. There is a Feature Request that covers your scenario, but unfortunately, that is still collecting votes for future implementation. We recommend you vote and watch that FR so you get notified once it move forward on its implementation.

As a workaround, you can add a single script task at the top of the very first Stage of your Plan that will exit if it's the first time the build is happening.

Windows:

if ( ${bamboo.buildNumber} -eq 1 ) {
  $host.ui.WriteErrorLine("First build on branch killed to avoid unnecessary build")
  exit 1
}

Linux:

if [ ${bamboo_buildNumber} -eq 1 ] ; then
  echo "First build on branch killed to avoid unnecessary build"
  exit 1
fi 

As a result, the first run after creating a branch will fail immediately and you will avoid unnecessary work.

Sincerely,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Like Gustavo Segura likes this
Rainer Sinkwitz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 23, 2024

Must be buildNumber, not buildnumber (linux example)

Like Eduardo Alvarenga likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events