Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60432

Bitbucket ignore Jenkinsfile checkout for merge conflicted PRs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Jenkins 2.176.4
      bitbucket-branch-source-plugin 2.5.0

      The bitbucket-branch-source-plugin creates a full clone on the master of repos when trying to build PRs that are in a conflicted state, taking up potentially lots of space depending on the number of outstanding merge conflicts and the size of the repo.

      The bitbucket-branch-source-plugin attempts to do a lightweight checkout of the Jenkinsfile on the master, and failing that falls back to a full clone. The logic being used in the case of PRs is to do a GET to the Bitbucket rest api to retrieve the Jenkinsfile. However, in the case of a PR that is in a merge conflict state, that api endpoint does not exist (which makes sense because there is no merged codebase) resulting in a heavyweight clone on the master.

      The end result is the Jenkinsfile is still not obtained via the heavyweight clone because the merge of the code can't happen locally on the Jenkins agent, so the heavyweight fallback in this case is spending time and resources doing a clone, and if you have a large repo it consumes a lot of space on the master for indefinite periods of time if nobody cleans up the or fixes the merge conflicted PRs.

      I believe a good solution would be for PRs to first do a rest call to the Bitbucket api to check that the PR is not in a merge conflict state before attempting to checkout the Jenkinsfile.

            Unassigned Unassigned
            buzzard44 Caleb Mayeux
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: