Can Bamboo notify auto-merged commits to stash?

Shago November 10, 2013

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

1 vote
Answer accepted
Alexey_Efimov
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.
November 12, 2013

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

Shago November 12, 2013

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.

Alexey_Efimov
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.
November 12, 2013

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.

Shago November 12, 2013

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

Shago November 12, 2013

This is the config:

Branch Updater Config

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events