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

Allow specifying commit for multibranch pipeline build

XMLWordPrintable

      We have a Jenkins multi-branch pipeline backed by a Jenkinsfile contained in the source repo. For various reasons, we would like to split this huge Jenkinsfile into a few (two or three) smaller, more focused Jenkinsfiles. Each of these Jenkinsfiles will correspond to a different multi-branch pipeline. The intent is that a push to Git will only trigger a build of some master orchestration Jenkinsfile, which in turn triggers the other downstream jobs via theĀ build step. https://jenkins.io/doc/pipeline/steps/pipeline-build-step/ All of these Jenkinsfiles will live together in the source repo.

      However, the problem with this approach is that when you trigger a multi-branch pipeline job, it is going to use the Jenkinsfile from whatever the head of the branch in question is at that time. This can cause weird problems if, for example, the branch in question gets pushed to after the orchestration build starts, but before it triggers the downstream job.

      We would like the ability to have the build step trigger a build for a specific commit hash of the branch in question. In particular, the orchestration build will collect its own commit hash from checkout(scm).GIT_COMMIT and pass it to the build step.

      From what I understand, the code changes necessary would be right around here. https://github.com/jenkinsci/workflow-multibranch-plugin/blob/f9b5cd015093ae6c03601b4fcb52609edac4f6c3/src/main/java/org/jenkinsci/plugins/workflow/multibranch/SCMBinder.java#L102

            Unassigned Unassigned
            rittneje Jesse Rittner
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: