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

Job parameters should be exposed as environment variables

    XMLWordPrintable

Details

    Description

      I noticed that job input parameters are not available inside of the sh task
      for example:

      sh 'echo ${ARTIFACTS}'
      

      I'm aware of that I can interpolate the variable but I have scripts which expects to have variables set.

      // expects to have ARTIFACTS env available 
      sh('./some-python-script.py')) 
      

      Migration from my old hand patched pipeline to the new workflow would be easier if Job parameters and injected environment variables are available like in the regular script step (freestyle project)

      Attachments

        Issue Links

          Activity

            abayer Andrew Bayer added a comment -

            hrmpw So I think input step return values are a different thing than ParameterValue...

            abayer Andrew Bayer added a comment - hrmpw So I think input step return values are a different thing than ParameterValue ...
            abayer Andrew Bayer added a comment -

            jglick Why don't we have an equivalent to this in WorkflowRun? If we did, we'd pick up ParameterAction contributions automatically...

            abayer Andrew Bayer added a comment - jglick Why don't we have an equivalent to this in WorkflowRun ? If we did, we'd pick up ParameterAction contributions automatically...

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java
            http://jenkins-ci.org/commit/workflow-job-plugin/219fde38743eccc3c91cdd32f3061645583d8314
            Log:
            [FIXED JENKINS-30910] Build environment should include parameters.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java http://jenkins-ci.org/commit/workflow-job-plugin/219fde38743eccc3c91cdd32f3061645583d8314 Log: [FIXED JENKINS-30910] Build environment should include parameters.

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/86c7ea988f371a8b50d2a2ed41ad2fcb4cd6de25
            Log:
            [FIXED JENKINS-28447] CpsScmFlowDefinition does not resolve variables.
            Actual fix is implied by JENKINS-30910; this is just the integration test.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/86c7ea988f371a8b50d2a2ed41ad2fcb4cd6de25 Log: [FIXED JENKINS-28447] CpsScmFlowDefinition does not resolve variables. Actual fix is implied by JENKINS-30910 ; this is just the integration test.
            wimederveen Wim Ederveen added a comment -

            With the fix in job plugin 2.7 we are able to start a pipeline build while using the choice parameter

            wimederveen Wim Ederveen added a comment - With the fix in job plugin 2.7 we are able to start a pipeline build while using the choice parameter

            People

              jglick Jesse Glick
              dkuffner Daniel Kuffner
              Votes:
              24 Vote for this issue
              Watchers:
              36 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: