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

"Pipeline script from SCM" does not load Jenkinsfile from a git parameter (branch)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • pipeline
    • None

      Error Description

       

      When defining a pipeline job, If a Git Parameter (Branch) is configured to list all branches - we cannot see all branches under the selected repository if we are to choose pipeline script from SCM

       

      However, if the same is done using Pipeline Script (raw text script) with Groovy environment, it works fine and we can see all branches for a repo.

      **Step to Reproduce

      1. Log in to Jenkins Server (no need to be admin) - and duplicate browser tabs (or open new window from same browser) for easy comparison.
      2. In one browser tab, create a pipeline job using the raw script (text)
        1. Ensure that your pipeline script takes a Git Parameter (Branch_Name) and the parameter is added through "This Script is Parameterized" option at the beginning of Pipeline creation window.
          1. See screenshot below
        2. Ensure that the script is pasted in the text window for Pipeline script in "Advanced Option" - see screenshot above for reference.
        3. Ensure that the repository which you are trying to checkout and build (through pipeline script) has multiple branches - 2-3 are sufficient
      1. now try and click "Build with Parameters" - you will see that all your branches from 2.3 above are visible in Git Parameter "Branch_Name" selection window.
      2. Now go to the 2nd browser tab/window - and repeat 1-2 except this time, choose Pipeline Script from SCM for Advanced Option
        1. You will need to store your Jenkinsfile in an accessible Git repository. See the very first screenshot above for reference.
      1. Now repeat step #3 - you can see that only master branch is visible.

      Possible RCA

      It almost seems that Jenkins Pipeline creation process is getting confused between checking out source repo and checking out Jenkinsfile from source repo. The reasoning is due to having the following branch selection option (highlighted)

      It's likely that when the list is being passed around - somwhere the loading has gone wrong and between UI and Backend. Unfortunately, I cannot prove it.

      In any way - if this is not a bug, then it's a poorly-formed design. And we cannot have our Jenkinsfile running without SCM control and de-centralised. So, please provide a patch asap.

      Regards,

            Unassigned Unassigned
            manmedia Mohammed Manna
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: