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

PipelineScript from SCM does not support job parameters



    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Duplicate
    • pipeline
    • Jenkins
      Workflow-cps 1.15


      On normal maven/freestyle jobs the checked out branch can be parameterized with job parameters.
      The following job uses the workflow plugin to pull a groovy script from scm.
      Here the ${branch} variable is not substituted.

      <?xml version="1.0" encoding="UTF-8"?>
      <flow-definition plugin="workflow-job@1.15">
          <actions />
          <description>WARNING: this jobs fails due to not substituting ${branch} on ckeckout.</description>
              <hudson.plugins.buildblocker.BuildBlockerProperty plugin="build-blocker-plugin@1.7.3">
                  <blockingJobs />
                          <description />
                          <defaultValue />
                          <description />
          <definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="workflow-cps@1.15">
              <scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.3">
                          <name>refs/heads/${branch}</name><!-- THIS should be substituted but isn't -->
                  <submoduleCfg class="list" />
          <triggers />

      The result is:

      Started by user Dreyer Ulf
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url ssh://git@imbvl2vm294.bosch-si.com:7999/brm/vr-releng__release-scripts.git # timeout=10
      Fetching upstream changes from ssh://git@imbvl2vm294.bosch-si.com:7999/brm/vr-releng__release-scripts.git
       > git --version # timeout=10
       > git -c core.askpass=true fetch --tags --progress ssh://git@someServer.com:7999/someRepo.git +refs/heads/*:refs/remotes/origin/*
       > git rev-parse refs/remotes/origin/${branch}^{commit} # timeout=10
       > git rev-parse refs/remotes/origin/refs/heads/${branch}^{commit} # timeout=10
       > git rev-parse refs/heads/${branch}^{commit} # timeout=10
      ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
      Finished: FAILURE

      when it really should substitute ${branch} with 6.4.x as it does in the rest of the script.


        Issue Links


            ulf_dreyer Ulf Dreyer created issue -
            mawi Martin Wirth made changes -
            Field Original Value New Value
            Labels param
            mawi Martin Wirth made changes -
            Labels param parameterized
            jglick Jesse Glick made changes -
            Link This issue duplicates JENKINS-28447 [ JENKINS-28447 ]
            jglick Jesse Glick made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 169688 ] JNJira + In-Review [ 198662 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]


              jglick Jesse Glick
              ulf_dreyer Ulf Dreyer
              12 Vote for this issue
              16 Start watching this issue