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

Lightweight checkout for PR merge jobs

    XMLWordPrintable

    Details

    • Sprint:
      Blue Ocean 1.4 - beta 2
    • Similar Issues:

      Description

      Please pull in the changes made to the SCM API to reduce the number of checkouts required for pipelines. Related to JENKINS-33273

       

      There was a mention in the referenced issue about PRs needing special treatment: "there is no implementation currently for github-branch-source-plugin in the case of a PR job configured to merge with the base branch, as GitHub does not offer an API dedicated to this purpose. In the case that the merge can be assumed to be a fast-forward (there is no base branch change subsequent to the common ancestor), this plugin could in principle load content via API from the PR branch; it would still need to fall back to full checkout and Git merge otherwise." - https://issues.jenkins-ci.org/browse/JENKINS-33273?focusedCommentId=292273#comment-292273

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            CC Patrick Wolf. My latest suggestion was to check if the file had been modified in at most one of the branches to be merged, and if so, load it via API; otherwise simply throw an AbortException requesting that the user push a merge commit, even when there is not necessarily a line-by-line conflict.

            Show
            jglick Jesse Glick added a comment - CC Patrick Wolf . My latest suggestion was to check if the file had been modified in at most one of the branches to be merged, and if so, load it via API; otherwise simply throw an AbortException requesting that the user push a merge commit, even when there is not necessarily a line-by-line conflict.
            Hide
            michaelneale Michael Neale added a comment -

            Jesse Glick I assume you mean content of the Jenkinsfile right? (which most of the time is not changed in a PR compared to other code, so chances of this just working are hight) - do I have that right? 

            Show
            michaelneale Michael Neale added a comment - Jesse Glick I assume you mean content of the Jenkinsfile right? (which most of the time is not changed in a PR compared to other code, so chances of this just working are hight) - do I have that right? 
            Hide
            jglick Jesse Glick added a comment -

            Michael Neale typically Jenkinsfile, though the name of that script is now customizable, and other files may be loaded with the same semantics from readTrusted; also from CpsScmFlowDefinition we could load any requested script.

            Show
            jglick Jesse Glick added a comment - Michael Neale typically Jenkinsfile , though the name of that script is now customizable, and other files may be loaded with the same semantics from readTrusted ; also from CpsScmFlowDefinition we could load any requested script.
            Hide
            jglick Jesse Glick added a comment -

            Worth checking whether this API can be used to actually perform the merge on the server side and then access file contents from that (unreferenced?) commit.

            Show
            jglick Jesse Glick added a comment - Worth checking whether  this API  can be used to actually perform the merge on the server side and then access file contents from that (unreferenced?) commit.
            Hide
            michaelneale Michael Neale added a comment -

            Jesse Glick perhaps - would want to create a new branch to merge into (so it doesn't do a merge about a branch anyone cares about) - however, it would likely then trigger a build... 

            Show
            michaelneale Michael Neale added a comment - Jesse Glick perhaps - would want to create a new branch to merge into (so it doesn't do a merge about a branch anyone cares about) - however, it would likely then trigger a build... 
            Hide
            hamiltb Bill Hamilton added a comment -

            Vivek Pandey any progress on this? We have many repos which are quite large, and do merge PR builds. The full workspace checkout is taxing our masters significantly.

             

            Show
            hamiltb Bill Hamilton added a comment - Vivek Pandey any progress on this? We have many repos which are quite large, and do merge PR builds. The full workspace checkout is taxing our masters significantly.  
            Hide
            jglick Jesse Glick added a comment -

            would want to create a new branch to merge into

            Depending on what the behavior of the endpoint is. If it actually modifies the base ref, you cannot use it. It is only useful if it creates a new dangling commit. The API does not seem to specify—it shows the merge commit hash being returned, but that is all.

            Show
            jglick Jesse Glick added a comment - would want to create a new branch to merge into Depending on what the behavior of the endpoint is. If it actually modifies the base ref, you cannot use it. It is only useful if it creates a new dangling commit. The API does not seem to specify—it shows the merge commit hash being returned, but that is all.
            Hide
            jglick Jesse Glick added a comment -

            Just tested it and it does update the remote base branch reference. So this API is useless, ignore it. Back to my original suggestion:

            check if the file had been modified in at most one of the branches to be merged, and if so, load it via API; otherwise simply throw an AbortException requesting that the user push a merge commit, even when there is not necessarily a line-by-line conflict

            Show
            jglick Jesse Glick added a comment - Just tested it and it does update the remote base branch reference. So this API is useless, ignore it. Back to my original suggestion: check if the file had been modified in at most one of the branches to be merged, and if so, load it via API; otherwise simply throw an  AbortException  requesting that the user push a merge commit, even when there is not necessarily a line-by-line conflict

              People

              • Assignee:
                rsandell rsandell
                Reporter:
                maxpowa Max Gurela
              • Votes:
                8 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated: