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

Bitbucket ignore Jenkinsfile checkout for merge conflicted PRs

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          buzzard44 Caleb Mayeux added a comment -

          In our case we have a large repo being used for gitops style work that's constantly bombarded with PR's from automated systems, many of which end up in conflicts and sit for some time. These unfortunate design choices end up causing scores of gigabyte sized clones on the master, which are threatening to fill up the Jenkins master's home directory. Resolving this issue would eliminate all that wasted space and also fail faster for merge conflicts.

          Show
          buzzard44 Caleb Mayeux added a comment - In our case we have a large repo being used for gitops style work that's constantly bombarded with PR's from automated systems, many of which end up in conflicts and sit for some time. These unfortunate design choices end up causing scores of gigabyte sized clones on the master, which are threatening to fill up the Jenkins master's home directory. Resolving this issue would eliminate all that wasted space and also fail faster for merge conflicts.

            People

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

              Dates

              Created:
              Updated: