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

Scripted Pipeline does not implicitly checkout the source code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Jenkins 2.401.2, Red Hat Enterprise Linux Server release 7.9 (Maipo)

      I set up 2 jobs (1 multibranch pipeline, 1 single branch pipeline) both pointing to the same Git repository and both using the same Jenkisfile to trigger the jobs.

       

      If I pushed an update on say branch1, the single branch pipeline job is showing the following on the console output:

      Fetching upstream changes from <URL to Git repo>
      ...
      ...
      Checking out Revision <commit hash>

       

      However, for the multibranch pipeline, it shows the following:

      Fetching upstream changes from origin

       

      Currently, these are the contents of the Jenkisfile:

      env.PARAM_REVISION = '3.2.3'
      node {
          stage('Build') {
              echo 'Build'
              echo "PARAM_REVISION: $PARAM_REVISION"
          }
          stage('Test') {
              echo 'Hello'
          }
      }

       

      Other info:

      • I have setup the multibranch pipeline to check out to matching local branch.  Please see attached image for this setting in the config

       

      Please check the attached console output of both jobs to see that the multibranch job is not checking out the code from the Git repo while the single branch pipeline is able to do so.  I watched the YouTube video on Jenkins Multibranch Pipeline With Git Tutorial and so far the job shows that the multibranch pipeline is able to checkout the update.  But somehow it's unable to do so on the Jenkins controller I'm using.

       

      The issue

      Multibranch pipeline is able to download the Jenkinsfile from GitHub and execute the steps in it but unable to checkout the actual codes from the same repository
       

      Expected behaviour

      The multibranch pipeline job should be able to checkout the updated branch

      Questions

      • What's the solution to this?
      • Do I need to setup single pipeline jobs for every branch?
      • Or do I need to include manual checkout of the updated branch from Git repository?

            Unassigned Unassigned
            fredsnest Fredan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: