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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,788
Community Members
 
Community Events
184
Community Groups

Bitbucket Pipeline build setup fails due to submodule merge conflict

Abhisht Singh
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!
Apr 28, 2023
I am trying to trigger a bitbucket pipeline on PR merge. The idea is to run testing on every merge to "development-branch".

Our repository includes a sub-repository inside it. Once the PR is issue, tests are run through bitbucket-pipelines and they work perfectly.

However, when we merge the same PR to the "development-branch", the 'build setup' step of the pipeline fails (I don't know how much of this is under my control through the YAML configuration). Here is a dummy error log

 

HEAD is now at 908c7e319 Merged in brandLevelErrorReportDev (pull request #4043)
+ git config user.name bitbucket-pipelines
+ git config user.email <valid> 
+ git config push.default current
+ git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/
+ git remote set-url origin http://bitbucket.org/$BITBUCKET_REPO_FULL_NAME
+ git reflog expire --expire=all --all
+ echo ".bitbucket/pipelines/generated" >> .git/info/exclude
+ CONFLICT_EXIT_CODE=3
+ git merge e81742c010ef --no-edit || exit $CONFLICT_EXIT_CODE
Auto-merging .gitignore
CONFLICT (content): Merge conflict in .gitignore
Auto-merging RandomService/RandomService.js
CONFLICT (content): Merge conflict in RandomService/RandomService.js
Failed to merge submodule RandomService/brand-files (not checked out)
CONFLICT (submodule): Merge conflict in RandomService/brand-files
Auto-merging RandomService/helpers/brand-functions.js
CONFLICT (content): Merge conflict in RandomService/helpers/brand-functions.js
Auto-merging RandomService/helpers/database-functions.js

Recursive merging with submodules currently only supports trivial cases.
Please manually handle the merging of each conflicted submodule.
This can be accomplished with the following steps:
 - come back to superproject and run:
      git add RandomService/<sub-repository folder>
   to record the above merge or update
 - resolve any other conflicts in the superproject
 - commit the resulting index in the superproject
Automatic merge failed; fix conflicts and then commit the result.

 

However, when I copy the "developement-branch" locally (with the merged PR) and run the following command,

git add RandomService/<sub-repository folder>

I get "nothing to commit, up to date"

I tried the suggested commands, and tried to improve the yml to have

clone: 
   depth: 5 # previously the value was "full"

The solutions have not worked

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 01, 2023

Hi @Abhisht Singh and welcome to the community!

Based on the log you shared here, this Pipelines build runs on a pull-requests definition of your bitbucket-pipelines.yml file. This type of pipeline merges the destination branch into your working branch before it runs (during the Build setup). If the merge fails (like in your build), the build stops.

You will need to first resolve the merge conflicts locally and then push back to the Bitbucket Cloud repo. You can find step-by-step instructions here:

In these instructions, replace <feature_branch> with the name of the source branch of the PR that triggered this build, and <destination_branch> with the name of the destination branch of the PR.

The depth of the clone is not relevant here, and the value you set for a pull-requests build will not be applied. A pull-requests build will always take a full-depth clone in order to merge.

Kind regards,
Theodora

Abhisht Singh
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!
May 01, 2023

Hi Theodora, 

 

Thank you for your quick reply. I just wanted to mention that I am unable to see any such merge conflict on my local. 

 

Infact, if I run a build based on the branch setting and trigger the same tests on my branch, it passes without issues. 

 

I would like to tell you more about my bitbucket-pipelines.yml file 

pipelines: 
branches:
destination-branch:
- step:
script:
- echo "Merge build" # build is successful

pull-requests:
destination-branch*: ## all PR with "destination-branch" prefix
- step:
size: 2x
name: "Running Tests"
script:
- echo "PR build" # build is successful during PR stage and
  # as soon as we merge the PR, the build is unsuccessful


This is super weird behaviour because I have still not been able to discover any merge conflicts locally. And if say there are merge conflicts, the builds are passing while the PR is not merged. 

on the merge-related commit fails the build. 

 

I hope I was able to describe my problem better. 

Thank you, 

Abhisht Singh 

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 01, 2023

Hi @Abhisht Singh,

Thank you for sharing additional info.

Infact, if I run a build based on the branch setting and trigger the same tests on my branch, it passes without issues.

A build that runs based on a branches definition doesn't do any merge during Build setup. E.g. for a build that runs on this definition:

branches:
  destination-branch:

A Docker container will start and the branch named destination-branch will be cloned in the Docker container. This will happen during the Build setup. This kind of pipeline will run every time there are new commits on destination-branch (either because someone pushed, or because a PR was merged into destination-branch)


For the following definition:

pull-requests:
destination-branch*:

A Pipelines build will run when a PR is created with source branch a branch that matches destination-branch*, and every time the source branch of the PR gets updated. Please keep in mind that this won't get triggered when destination-branch* is the destination branch.

This type of Pipeline will start a Docker container, clone the source branch of the PR in the container, and then merge the PR's destination branch into the source branch. This is where the merge is happening when your Pipeline fails.


In order to resolve the conflicts locally, you need to attempt to pull (locally) the destination branch into the source branch. Please see all the steps in the link I shared (and make sure you have pulled the latest updates of the source branch).

 

Kind regards,
Theodora

Like Abhisht Singh likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events