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

Environment variables are not expanded and thus cannot be used as parameter values to Scriptler scripts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: active-choices-plugin
    • Labels:
      None
    • Environment:
      Version 1.0 of Active Choices plugin
    • Similar Issues:

      Description

      I'm using a "Active Choices Parameter" on a parameterized build (by selecting "This build is parameterized" in the job settings). If I've defined a global environment variables/properties or password in Jenkins (defined under "Manage Jenkins" -> "Configure System" -> "Global Properties" and "Manage Jenkins" -> "Configure System" -> "Global Passwords") I cannot seem to use these (for example ${MY_ENV_NAME}) as an input parameter to Scriptler scripts. This means that I have to duplicate my global environment variable value when used together with the active choice plugin which is not optimal. The passwords are also visible in clear text when configuring the project.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/main/java/org/biouno/unochoice/model/ScriptlerScript.java
          http://jenkins-ci.org/commit/active-choices-plugin/d57ac661e202258343739af270d383288cf85e96
          Log:
          [FIXED JENKINS-28764] Add environment variables to binding context of Scriptler groovy scripts too (already in Groovy scripts)

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/main/java/org/biouno/unochoice/model/ScriptlerScript.java http://jenkins-ci.org/commit/active-choices-plugin/d57ac661e202258343739af270d383288cf85e96 Log: [FIXED JENKINS-28764] Add environment variables to binding context of Scriptler groovy scripts too (already in Groovy scripts)
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Adding the system environment variables to the binding context of the Scriptler parameter. Hopefully that'll make your variables available in your script.

          Show
          kinow Bruno P. Kinoshita added a comment - Adding the system environment variables to the binding context of the Scriptler parameter. Hopefully that'll make your variables available in your script.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/main/java/org/biouno/unochoice/model/ScriptlerScript.java
          src/main/java/org/biouno/unochoice/util/Utils.java
          src/test/java/org/biouno/unochoice/issue28764/TestIssue28764.java
          src/test/java/org/biouno/unochoice/issue28764/package-info.java
          http://jenkins-ci.org/commit/active-choices-plugin/2ee4d3412da98bb132990bb1d790f8dd5bdf453c
          Log:
          JENKINS-28764 Write tests and fix possible bug before shipping code

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/main/java/org/biouno/unochoice/model/ScriptlerScript.java src/main/java/org/biouno/unochoice/util/Utils.java src/test/java/org/biouno/unochoice/issue28764/TestIssue28764.java src/test/java/org/biouno/unochoice/issue28764/package-info.java http://jenkins-ci.org/commit/active-choices-plugin/2ee4d3412da98bb132990bb1d790f8dd5bdf453c Log: JENKINS-28764 Write tests and fix possible bug before shipping code
          Hide
          sgannon200 Shane Gannon added a comment -

          Where can I get this fix? Does it require a Jenkins or plugin update?

          Show
          sgannon200 Shane Gannon added a comment - Where can I get this fix? Does it require a Jenkins or plugin update?
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Hi Shane

          Yes, you have to update the active-choices-plugin. The easiest way is through the plug-in manager in Jenkins interface (Manage Plugins option in Jenkins configuration).

          The release 1.1 included this issue. So any version greater or equal to 1.1 should include it.

          Hope that helps,
          Bruno

          Show
          kinow Bruno P. Kinoshita added a comment - Hi Shane Yes, you have to update the active-choices-plugin. The easiest way is through the plug-in manager in Jenkins interface (Manage Plugins option in Jenkins configuration). The release 1.1 included this issue. So any version greater or equal to 1.1 should include it. Hope that helps, Bruno
          Hide
          sgannon200 Shane Gannon added a comment -

          Hi Bruno

          Thanks for replying. I'm seeing this on version 1.2 of the Active Choices Plugin. No upgrade is available.

          For me variables like $COMPUTERNAME and $Path expand (because they are defined on the Jenkins master). But variables from Global Properties do not expand. Does this match you understanding of JENKINS-28764?

          Regards
          Shane

          Show
          sgannon200 Shane Gannon added a comment - Hi Bruno Thanks for replying. I'm seeing this on version 1.2 of the Active Choices Plugin. No upgrade is available. For me variables like $COMPUTERNAME and $Path expand (because they are defined on the Jenkins master). But variables from Global Properties do not expand. Does this match you understanding of JENKINS-28764 ? Regards Shane

            People

            Assignee:
            kinow Bruno P. Kinoshita
            Reporter:
            johanhaleby Johan Haleby
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: