-
New Feature
-
Resolution: Fixed
-
Minor
-
None
With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already do with `duration` and `description`)
For example,
def e = build "test-env" echo "${e.environment.GIT_COMMIT}" echo "${e.environment.FOO}"
I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR here for JENKINS-36306
The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is blacklisted
def e = build "test-env" echo "${e.rawBuild.environment.GIT_COMMIT}"
Thanks
- is duplicated by
-
JENKINS-36213 build-step - obtain environment variables from a non-pipeline job
-
- Resolved
-
- links to
[JENKINS-36528] Return map of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
Description |
Original:
With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do](https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job)) For example, ``` def e = build "test-env" echo "${e.environment.GIT_COMMIT}" echo "${e.environment.FOO}" ``` I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here](https://github.com/jenkinsci/workflow-support-plugin/pull/6) for The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted](https://github.com/jenkinsci/script-security-plugin/pull/69) ``` def e = build "test-env" echo "${e.rawBuild.environment.GIT_COMMIT}" ``` Thanks :) |
New:
With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do](https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job)) For example, {code} def e = build "test-env" echo "${e.environment.GIT_COMMIT}" echo "${e.environment.FOO}" {code} I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here](https://github.com/jenkinsci/workflow-support-plugin/pull/6) for The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted](https://github.com/jenkinsci/script-security-plugin/pull/69) {code} def e = build "test-env" echo "${e.rawBuild.environment.GIT_COMMIT}" {code} Thanks :) |
Description |
Original:
With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do](https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job)) For example, {code} def e = build "test-env" echo "${e.environment.GIT_COMMIT}" echo "${e.environment.FOO}" {code} I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here](https://github.com/jenkinsci/workflow-support-plugin/pull/6) for The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted](https://github.com/jenkinsci/script-security-plugin/pull/69) {code} def e = build "test-env" echo "${e.rawBuild.environment.GIT_COMMIT}" {code} Thanks :) |
New:
With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do|https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job]) For example, {code} def e = build "test-env" echo "${e.environment.GIT_COMMIT}" echo "${e.environment.FOO}" {code} I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here|https://github.com/jenkinsci/workflow-support-plugin/pull/6] for [ The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted|https://github.com/jenkinsci/script-security-plugin/pull/69] {code} def e = build "test-env" echo "${e.rawBuild.environment.GIT_COMMIT}" {code} Thanks :) |
Summary | Original: Return list of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper | New: Return map of environment variables of job in org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper |
Description |
Original:
With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can already with `duration` and `description` [already do|https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job]) For example, {code} def e = build "test-env" echo "${e.environment.GIT_COMMIT}" echo "${e.environment.FOO}" {code} I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here|https://github.com/jenkinsci/workflow-support-plugin/pull/6] for [ The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted|https://github.com/jenkinsci/script-security-plugin/pull/69] {code} def e = build "test-env" echo "${e.rawBuild.environment.GIT_COMMIT}" {code} Thanks :) |
New:
With the Pipeline Plugin, I'd like a list of environment variables to be returned from the build result of a job (like you can [already do|https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job] with `duration` and `description`) For example, {code} def e = build "test-env" echo "${e.environment.GIT_COMMIT}" echo "${e.environment.FOO}" {code} I believe the fix is to add a whitelisted getEnvironment() method to the RunWrapper, similar to the one done in this merged PR [here|https://github.com/jenkinsci/workflow-support-plugin/pull/6] for [ The current fix is to access the environment variables is to access it via the rawBuild, however that needs to be explicitly whitelisted as RunWrapper.getRawBuild is [blacklisted|https://github.com/jenkinsci/script-security-plugin/pull/69] {code} def e = build "test-env" echo "${e.rawBuild.environment.GIT_COMMIT}" {code} Thanks :) |
Workflow | Original: JNJira [ 173241 ] | New: JNJira + In-Review [ 185015 ] |
Component/s | New: pipeline-general [ 21692 ] |
Component/s | Original: workflow-plugin [ 18820 ] |
Labels | Original: pipeline-build-step-plugin |
Component/s | New: workflow-support-plugin [ 21719 ] | |
Component/s | Original: pipeline [ 21692 ] |