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

Advertise available environment variables

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Right now there is no easy way to find, when writing a flow script, which environment variables will be predefined.

      EnvironmentContributor/EnvVarsHtml/index.groovy renders CoreEnvironmentContributor/buildEnv.groovy. This will be somewhat misleading since EXECUTOR_NUMBER, NODE_NAME, and NODE_LABELS are not currently set for flow builds (since they do not make sense in general, and buildEnvironment is not going to be called from an Executor thread). This page also seems to be documenting variables that CoreEnvironmentContributor does not actually set, including WORKSPACE (from AbstractBuild.getEnvironment) which is also not currently available for flow builds. Setting these variables from ExecutorStepExecution would be welcome. (BUILD_NUMBER, BUILD_ID, and BUILD_TAG are from Run.getCharacteristicEnvVars and are available for flows; likewise JOB_NAME from Job.getCharacteristicEnvVars—curiously JOB_URL is set by CoreEnvironmentContributor.)

      At any rate, linking to this page (${rootURL}/env-vars.html) from somewhere in the configuration page for a script would be welcome. Perhaps from help.* of the sh/bat scripts, analogous to the standard Jenkins usage from hudson/tasks/Shell/config.properties etc.?

        Attachments

          Issue Links

            Activity

            jglick Jesse Glick created issue -
            tfennelly Tom FENNELLY made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ] Tom FENNELLY [ tfennelly ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 75 (Web Link)" [ 12142 ]
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-26128 [ JENKINS-26128 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Tom Fennelly
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html
            http://jenkins-ci.org/commit/workflow-plugin/20212cec2d17976dedf3d42f518c9210f9af7a4f
            Log:
            Merge pull request #75 from tfennelly/JENKINS-27145

            JENKINS-27145 Linking to env-vars.html from UI

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/0e956a5e3ae6...20212cec2d17

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Tom Fennelly Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html http://jenkins-ci.org/commit/workflow-plugin/20212cec2d17976dedf3d42f518c9210f9af7a4f Log: Merge pull request #75 from tfennelly/ JENKINS-27145 JENKINS-27145 Linking to env-vars.html from UI Compare: https://github.com/jenkinsci/workflow-plugin/compare/0e956a5e3ae6...20212cec2d17
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            CHANGES.md
            http://jenkins-ci.org/commit/workflow-plugin/5a44ff738256ce531a01eea81edbb1555063e2ec
            Log:
            JENKINS-27145 Noting #75 in changelog.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: CHANGES.md http://jenkins-ci.org/commit/workflow-plugin/5a44ff738256ce531a01eea81edbb1555063e2ec Log: JENKINS-27145 Noting #75 in changelog.
            tfennelly Tom FENNELLY made changes -
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Resolved [ 5 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: tfennelly
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/WorkspaceStepTest.java
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html
            cps/src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStepExecution.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepExecution.java
            support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep/config.jelly
            support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep/help-dir.html
            support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep/config.jelly
            support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep/help-quietPeriod.html
            support/src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepTest.java
            http://jenkins-ci.org/commit/workflow-plugin/772063078e09d19adb881f4c5d52188c0ba36620
            Log:
            Merge branch 'master' into JENKINS-26122

            • master:
              JENKINS-27145 Noting #75 in changelog.
              Updating list of unavailable variables (again ).
              [FIXED JENKINS-26692] Added BuildTriggerStep.quietPeriod.
              @tfennelly requests more descriptive variable names.
              Needed to update a test as well.
              [FIXED JENKINS-26072] Added WorkspaceStep.dir.
              Updating list of unavailable variables.
              Linking to environment variable (${rootURL}/env-vars.html) in the workflow script help page.

            Conflicts:
            CHANGES.md

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/WorkspaceStepTest.java cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html cps/src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStepExecution.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepExecution.java support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep/config.jelly support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep/help-dir.html support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep/config.jelly support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep/help-quietPeriod.html support/src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepTest.java http://jenkins-ci.org/commit/workflow-plugin/772063078e09d19adb881f4c5d52188c0ba36620 Log: Merge branch 'master' into JENKINS-26122 master: JENKINS-27145 Noting #75 in changelog. Updating list of unavailable variables (again ). [FIXED JENKINS-26692] Added BuildTriggerStep.quietPeriod. @tfennelly requests more descriptive variable names. Needed to update a test as well. [FIXED JENKINS-26072] Added WorkspaceStep.dir. Updating list of unavailable variables. Linking to environment variable (${rootURL}/env-vars.html) in the workflow script help page. Conflicts: CHANGES.md
            jglick Jesse Glick made changes -
            Link This issue depends on JENKINS-28131 [ JENKINS-28131 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: tfennelly
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html
            cps/src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/6577037dfc574ec618f3475936081dc3bb223dd8
            Log:
            Merge branch 'master' into JENKINS-26122

            • master:
              JENKINS-27145 Noting #75 in changelog.
              Updating list of unavailable variables (again ).
              [FIXED JENKINS-26692] Added BuildTriggerStep.quietPeriod.
              @tfennelly requests more descriptive variable names.
              Needed to update a test as well.
              [FIXED JENKINS-26072] Added WorkspaceStep.dir.
              Updating list of unavailable variables.
              Linking to environment variable (${rootURL}/env-vars.html) in the workflow script help page.

            Conflicts:
            CHANGES.md

            Originally-Committed-As: 772063078e09d19adb881f4c5d52188c0ba36620

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html cps/src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/6577037dfc574ec618f3475936081dc3bb223dd8 Log: Merge branch 'master' into JENKINS-26122 master: JENKINS-27145 Noting #75 in changelog. Updating list of unavailable variables (again ). [FIXED JENKINS-26692] Added BuildTriggerStep.quietPeriod. @tfennelly requests more descriptive variable names. Needed to update a test as well. [FIXED JENKINS-26072] Added WorkspaceStep.dir. Updating list of unavailable variables. Linking to environment variable (${rootURL}/env-vars.html) in the workflow script help page. Conflicts: CHANGES.md Originally-Committed-As: 772063078e09d19adb881f4c5d52188c0ba36620
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 161341 ] JNJira + In-Review [ 196723 ]
            abayer Andrew Bayer made changes -
            Component/s pipeline-general [ 21692 ]
            abayer Andrew Bayer made changes -
            Component/s workflow-plugin [ 18820 ]

              People

              Assignee:
              tfennelly Tom FENNELLY
              Reporter:
              jglick Jesse Glick
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: