Can Bamboo notify auto-merged commits to stash?

I have the following scenario with Bamboo/Stash:

  • A plan is configured to use automatic merge with the branch updater model.
  • Then plan is set to send a notification to Stash whenever it gets a green build.
  • The repository is set to require a green build to allow merging of pull requests.

The problem is that when the build sends the auto-merged commit to stash it does not notify it as good, but since it is the last commit Stash does not enable the merge button. As a workaround we have to run another build (run manually) of the same branch plan, but I think that should not be needed since Bamboo will build the same thing that it already did.

Is there another solution?

1 answer

1 accepted

If you ask about pull requests automerge commit, then you should extend standard build-integration plugin to enable handling of `merge` references. Standard plugin handles only `from` references.

The idea of testing automatical merge references on CI server is not so good in fact. Imagine that you have 10 pull requests into 'master' branch to be merged after green builds. At begin, CI run 10 builds (for example, one per each pull request). Then first pull request merged, the 'master' branch was updated, and all remaining unmerged pull requests must be rebuilded. All automatical merge references will be deleted (for remaing 9 pull requests) and recreated from fresh 'master'. Then CI run another 9 builds again. And so on. (N^2)/2 builds requires to be runned on CI server for merging N pull requests, if you enable cheking for automerge commit.

Here is discussion for another one aproach, but it look like not very likelly from Atlassian side. They did not like that idea :)

https://jira.atlassian.com/browse/STASH-3903

And very long discussion:

https://answers.atlassian.com/questions/212418/reduce-of-rebuilding-automerge-commits

I'm actually trying to reduce the number of builds not the other way around.

I don't really understand the example you give about the multiple builds. Why should I rebuild the remaining branches with every merge?

  • If I had 10 pull request (PR).
  • PR1 gets merged creating commit A on master.
  • Developer push commit B to PR2 branch.
    • Bamboo merges A from master on PR2 branch
    • Bamboo compiles PR2 branch
    • Bamboo tells Stash that commit B is good.
    • Bamboo creates commit C on PR2
  • Stash says last commit on PR2 is C but I don't have green build for that.
  • Developer must run manually PR2 branch plan.
    • Bamboo compiles PR2 branch
    • A: Bamboo tells Stash that commit C is good.
    • Stash can merge PR2 into master.
  • Developer merges PR2 to master.
    • B: Bamboo compiles master.

A: But Bamboo already knew that commit C was good, and really is a pain, the developer knows upfront he needs to wait 2 builds that are virtually equal.

B: This build also seems unnecesary to me, unless PR2 receives another commit before merging.

I don't see the other PRs' branches rebuilding, unless they also receive commits meanwhile PR2 was building, in that case I can see the build count raising, but I doubt it will go as high as 50 as you suggested.

Anyways creating or modifying a plugin seems the best way to go.

Stash creates Automerge commit inside, it happened automatically then target or source branch changed and pull request overview page accessed buy user. But you can't merge outdated pull request, Stash will rebuild it, and creates new refs/pull-request/1234/merge reference within Git.

I can't understand what you mean about 'Bamboo merges'. Your CI merges Pull Requests within Stash? We using own auotmerge plugin for this, PR requests merged automatically as soon as possible -- all build are green, all reviewers approved, etc.

In any case, compiling on source branch of PR not allow to be sure, that merging does not brake target branch. It might be green build on source branch in unmerged PR and failed master after merge.

I think we are talking about different auto-merges. I'm talking about the branch updater described here: https://confluence.atlassian.com/display/BAMBOO/Using+plan+branches#Usingplanbranches-Usingautomaticmerging

I have the following config where Debug branch points to master.
Branch Updater Configuration

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,211 views 26 11
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you