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

Pipeline script from SCM does not expand build parameters/env variables for lightweight checkouts

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • Jenkins LTS 2.32.3 + All plugins up to date.

      Pipeline: Build Step : 2.4
      Git client plugin : 2.3
    • git plugin 4.14.0, workflow-cps (pipeline-groovy) 3601.v9b_36a_d99e1cc

      Pipeline from SCM does not expand parameters or environment variables 

      Steps to reproduce:

      • Create a new Pipeline with a String Parameter  "PIPELINE_BRANCH"
      • In the pipeline definition ; Select "Pipeline Script from SCM"
      • Enter the repository URL
      • In branch to build, enter the parameter  : ${PIPELINE_BRANCH}
      • Enter your script path
      • Run the job with a valid branch

       An error in thrown :
      hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/${PIPELINE_BRANCH}:refs/remotes/origin/${PIPELINE_BRANCH} --prune" returned status code 128:
      stdout:
       

      ${PIPELINE_BRANCH} is not  replaced by its value.

      Same issue with an environment variable.

      Expanding parameters/variable is working fine for a freestyle or matrix job.

       

       

       

       

       

          [JENKINS-42971] Pipeline script from SCM does not expand build parameters/env variables for lightweight checkouts

          Bertrand Latinville created issue -
          Bertrand Latinville made changes -
          Description Original: Pipeline from SCM does not expand parameters or environment variables :(

          Steps to reproduce:
           * Create a new Pipeline with a String Parameter  "PIPELINE_BRANCH"
           * In the pipeline definition ; Select "Pipeline Script from SCM"
           * Enter the Repository URL

           * In branch to build, enter the parameter  : $\{PIPELINE_BRANCH}
           * Enter your script path
           * Run the job with a valid branch

           An error in thrown :
          hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/$\{PIPELINE_BRANCH}:refs/remotes/origin/$\{PIPELINE_BRANCH} --prune" returned status code 128:
          stdout:
           

          $\{PIPELINE_BRANCH} is not  replaced by its value.

          Same issue with an environment variable.

          Expanding parameters/variable is working fine for a Freestyle or matrix job.

           

           

           

           

           
          New: Pipeline from SCM does not expand parameters or environment variables 

          Steps to reproduce:
           * Create a new Pipeline with a String Parameter  "PIPELINE_BRANCH"
           * In the pipeline definition ; Select "Pipeline Script from SCM"
           * Enter the Repository URL

           * In branch to build, enter the parameter  : $\{PIPELINE_BRANCH}
           * Enter your script path
           * Run the job with a valid branch

           An error in thrown :
           hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/$\{PIPELINE_BRANCH}:refs/remotes/origin/$\{PIPELINE_BRANCH} --prune" returned status code 128:
           stdout:
            

          $\{PIPELINE_BRANCH} is not  replaced by its value.

          Same issue with an environment variable.

          Expanding parameters/variable is working fine for a Freestyle or matrix job.

           

           

           

           

           
          Bertrand Latinville made changes -
          Description Original: Pipeline from SCM does not expand parameters or environment variables 

          Steps to reproduce:
           * Create a new Pipeline with a String Parameter  "PIPELINE_BRANCH"
           * In the pipeline definition ; Select "Pipeline Script from SCM"
           * Enter the Repository URL

           * In branch to build, enter the parameter  : $\{PIPELINE_BRANCH}
           * Enter your script path
           * Run the job with a valid branch

           An error in thrown :
           hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/$\{PIPELINE_BRANCH}:refs/remotes/origin/$\{PIPELINE_BRANCH} --prune" returned status code 128:
           stdout:
            

          $\{PIPELINE_BRANCH} is not  replaced by its value.

          Same issue with an environment variable.

          Expanding parameters/variable is working fine for a Freestyle or matrix job.

           

           

           

           

           
          New: Pipeline from SCM does not expand parameters or environment variables 

          Steps to reproduce:
           * Create a new Pipeline with a String Parameter  "PIPELINE_BRANCH"
           * In the pipeline definition ; Select "Pipeline Script from SCM"
           * Enter the repository URL

           * In branch to build, enter the parameter  : $\{PIPELINE_BRANCH}
           * Enter your script path
           * Run the job with a valid branch

           An error in thrown :
           hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/$\{PIPELINE_BRANCH}:refs/remotes/origin/$\{PIPELINE_BRANCH} --prune" returned status code 128:
           stdout:
            

          $\{PIPELINE_BRANCH} is not  replaced by its value.

          Same issue with an environment variable.

          Expanding parameters/variable is working fine for a freestyle or matrix job.

           

           

           

           

           
          Summary Original: Pipeline script from SCM does not expand build parameters/env Variables. New: Pipeline script from SCM does not expand build parameters/env variables.

          Jesse Glick added a comment -

          Wrong component.

          Works if you have workflow-job 2.7+.

          Jesse Glick added a comment - Wrong component. Works if you have workflow-job 2.7+.
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-28447 [ JENKINS-28447 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          liyatikal added a comment -

          How is this bug resolved? 

          I'm using Jenkins 2.73.2, pipeline job and it still doesn't work.

          Is there a workaround for this?

          liyatikal added a comment - How is this bug resolved?  I'm using Jenkins 2.73.2, pipeline job and it still doesn't work. Is there a workaround for this?
          liyatikal made changes -
          Resolution Original: Duplicate [ 3 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

          liyatikal added a comment -

          The workaround that worked was to uncheck  the 'lightweight checkout'

          liyatikal added a comment - The workaround that worked was to uncheck  the 'lightweight checkout'
          Andrew Bayer made changes -
          Component/s New: scm-api-plugin [ 18054 ]
          Component/s Original: pipeline-build-step-plugin [ 21707 ]

            martink89 Martin Kosicky
            blatinville Bertrand Latinville
            Votes:
            22 Vote for this issue
            Watchers:
            40 Start watching this issue

              Created:
              Updated:
              Resolved: