Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic Merging to develop with Hooks and Merge Checks

Matt Zmuda
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!
December 24, 2018

Is it possible to use Hooks and Merge Checks with Automatic Merging?

Here are the dilemma's I have run unit while trying out Automatic Merge:

  • Pull Request, please! hook is enabled to force PR for all code coming into develop and release branches
  • Merge Checks I am using
    • 1 Approval Required
    • 1 Build Required

I have a conflict between release/1.0.2 branch and develop. I merged a bug fix branch into release/1.0.0 with Automatic Merging enabled. The merge succeeded in release/1.0.0, release/1.0.1, release/1.0.2 but failed on merge to develop and created a new PR automatically to resolve the conflicts as expected.

I follow bitbucket instructions to resolve the conflict:

Step 1: Checkout the target branch and merge in the changes from the source branch. Resolve conflicts.

git checkout develop
git pull origin release/1.0.2

Step 2: After the merge conflicts are resolved, stage the changes accordingly, commit the changes and push.

git commit
git push origin HEAD

Problem I am running into now is that on git push origin HEAD the Pull Request Hook prevents me from pushing the changes.

 

$ git push origin HEAD
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 389 bytes | 389.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Commit without pull request
remote: ┌─┐┬ ┬┌┐ ┌┬┐┬┌┬┐ ┌─┐┬ ┬┬ ┬ ┬─┐┌─┐┌─┐ ┬ ┬┌─┐┌─┐┌┬┐
remote: └─┐│ │├┴┐││││ │ ├─┘│ ││ │ ├┬┘├┤ │─┼┐│ │├┤ └─┐ │
remote: └─┘└─┘└─┘┴ ┴┴ ┴ ┴ └─┘┴─┘┴─┘ ┴└─└─┘└─┘└└─┘└─┘└─┘ ┴
To ssh://my.code.com/therepo/mergecascadetest.git
! [remote rejected] HEAD -> develop (pre-receive hook declined)

 

My questions:

1) Is it possible to work around this Pull Request hook properly? Or is this a sacrifice you need to make if you want to use Automatic Merging?

2) I have a rule for at least 1 successful build to be present, since a branch does not exist for this merge a build will never be triggered. Is there a way to work around this? 

3) The rule for 1 approval would also never be satisfied since after the conflict is resolved and pushed the change is immediately done, effectively bypassing the approval process.

 

Am I doing something wrong or are automated merges very limiting when it comes to enforcing workflow?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events