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

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

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: scm-api-plugin
    • Labels:
      None
    • Environment:
      Jenkins LTS 2.32.3 + All plugins up to date.

      Pipeline: Build Step : 2.4
      Git client plugin : 2.3
    • Similar Issues:

      Description

      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.

       

       

       

       

       

        Attachments

          Issue Links

            Activity

            Hide
            tdensmore Todd Densmore added a comment -

            I am still seeing this as well. 

            Show
            tdensmore Todd Densmore added a comment - I am still seeing this as well. 
            Hide
            oschneider_precitec Oliver Schneider added a comment -

            I am also seeing this with Jenkins version 2.176.1 (from the Debian package repo provided by the Jenkins project).

            Show
            oschneider_precitec Oliver Schneider added a comment - I am also seeing this with Jenkins version 2.176.1 (from the Debian package repo provided by the Jenkins project).
            Hide
            medianick Nick Jones added a comment -

            We're seeing this same behavior today running Pipeline: Job (workflow-job) 2.32 (on Jenkins 2.176.1 LTS), with the "Lightweight checkout" checkbox unchecked. Is there a possibility that the system is still choosing a lightweight checkout essentially "on the fly", and if so, is there a way to force a heavyweight checkout?

            Show
            medianick Nick Jones added a comment - We're seeing this same behavior today running Pipeline: Job ( workflow-job ) 2.32 (on Jenkins 2.176.1 LTS), with the "Lightweight checkout" checkbox unchecked. Is there a possibility that the system is still choosing a lightweight checkout essentially "on the fly", and if so, is there a way to force a heavyweight checkout?
            Hide
            medianick Nick Jones added a comment -

            Aha – for us the issue was that we were reading a file from the workspace before the start of the the pipeline block, using a command like `def common = evaluate readTrusted('./Common.groovy')`. This seems to have bypassed the variable resolution. Removing this line caused the expected behavior to start again.

            Show
            medianick Nick Jones added a comment - Aha – for us the issue was that we were reading a file from the workspace before the start of the the pipeline block, using a command like `def common = evaluate readTrusted('./Common.groovy')` . This seems to have bypassed the variable resolution. Removing this line caused the expected behavior to start again.
            Hide
            docwarems Michael S. added a comment - - edited

            We have still a problem with Pipeline: Job 2.32 (even after upgrade to 2.36) on Jenkins 2.179. "Lightweight checkout" checkbox unchecked. Parameter Expansion does not work if parameter comes from "Properties File Path", It works, however, with parameter from "Properties Content". Too bad.

            BTW, our properties file is correct because it previously worked with a freestyle job.

            I created new issue JENKINS-60250.

            Show
            docwarems Michael S. added a comment - - edited We have still a problem with Pipeline: Job 2.32 (even after upgrade to 2.36) on Jenkins 2.179. "Lightweight checkout" checkbox unchecked. Parameter Expansion does not work if parameter comes from "Properties File Path", It works, however, with parameter from "Properties Content". Too bad. BTW, our properties file is correct because it previously worked with a freestyle job. I created new issue JENKINS-60250 .

              People

              • Assignee:
                Unassigned
                Reporter:
                blatinville Bertrand Latinville
              • Votes:
                19 Vote for this issue
                Watchers:
                24 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: