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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Why does a bitbucket pipeline on one branch try to merge with a commit from another branch Edited

We have a build that failed with the following log during the "Build Setup" step:
```
+ git reset --hard 38167b31fd00
HEAD is now at 38167b3 DAT-2701: fix some thing

+ git config user.name bitbucket-pipelines
+ git config user.email commits-noreply@bitbucket.org
+ git config push.default current
+ git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/

+ git remote set-url origin http://bitbucket.org/datylon/daty-vizlib
+ CONFLICT_EXIT_CODE=3
+ git merge 263e287ee12d --no-edit || exit $CONFLICT_EXIT_CODE
warning: Cannot merge binary files
```

38167b3 is the head of a feature branch.  263e287ee12d is a merge of that feature branch with our release branch.

So why does the pipeline setup for the feature branch merges in a commit that was made later?

2 answers

@Rutger_Claes do you mind sharing a snippet from your bitbucket-pipelines.yml file?

It sounds like you have defined a pull-requests section in your bitbucket-pipelines.yml file.

If a branch matches the pattern defined for pull-requests, when a pull request is created, the destination branch will be merged with the source branch, and a pipeline run against the result. This can be used run tests against the potential result of a merge.

If you don't want this behaviour, instead of defining a pull-requests section, use a regular branches section instead. e.g:


pipelines:
default:
- step:
script:
- echo "This script runs on all branches that don't have any specific pipeline assigned in 'branches'."
branches:
feature/*:
- step:
script:
- echo "This script runs only on commit to branches with names that match the feature/* pattern."
pull-requests:
feature/*:
- step:
script:
- echo "This script runs only on commit to branches with names that match the feature/* pattern when a pull request is raised."

 

We enountered the same problem. Our expectation was that the Pull Request build executes on the branch the pull request is from, and we don't want the build to use anything from the destination branch.

@Graham GatusThanks for the tip on using "branches" pattern, but this requires us to enforce using patterns when we create branches (e.g. /feature/...).

Seems Bit Bucket doesn't have any other option in this case and Pull Request pipelines becomes useless.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Bitbucket

Contest: Share your custom Bitbucket Pipe and win

Announced in this blog, this holiday season we’re celebrating all things CI/CD and between now and the end of 2019 we’ll be showcasing content, use cases, feature announcements and more. One featur...

2,132 views 11 6
Join discussion

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