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

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • active-choices-plugin
    • None
    • Version 1.0 of Active Choices plugin

      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.

          [JENKINS-28764] Environment variables are not expanded and thus cannot be used as parameter values to Scriptler scripts

          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)

          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)

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

          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.

          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

          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

          Shane Gannon added a comment -

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

          Shane Gannon added a comment - Where can I get this fix? Does it require a Jenkins or plugin update?

          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

          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

          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

          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

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

              Created:
              Updated:
              Resolved: