-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 1.609.1
workflow 1.8
Hello,
in Jenkins, I have two jobs:
- one freestyle named foo, which calls a shell script which does echo $BUILD_ID
- one workflow job
When trigerring the job foo from the workflow, it is not possible to get the env vars the build had. For example, if I do
def foo = build 'foo'
echo foo.buildVariables
echo foo.rawBuild.envVars
Then I only get null. However, it is possible, from the script console to get those variables using
def build = Jenkins.getInstance().getItemByFullName("foo").getBuildByNumber(6)
build.getEnvVars()
I get
Result: {BUILD_DISPLAY_NAME=#6, BUILD_ID=6, BUILD_NUMBER=6, BUILD_TAG=jenkins-foo-6, BUILD_URL=http://localhost:8080/job/foo/6/, CLASSPATH=, HUDSON_HOME=/****/jenkins-home, HUDSON_SERVER_COOKIE=****, HUDSON_URL=http://localhost:8080/, JENKINS_HOME=/****/jenkins-home, JENKINS_SERVER_COOKIE=****, JENKINS_URL=http://localhost:8080/, JOB_NAME=foo, JOB_URL=http://localhost:8080/job/foo/, WORKSPACE=/****/jenkins-home/jobs/foo/workspace}
The call to foo.getBuildVariables() return an empty map, but not null, as it is in the workflow.
The workflow is not sandboxed so the foo.rawBuild is a Run object as in the script console. The two code should return the exact same result, don't you think?
- is related to
-
JENKINS-33217 DescribableHelper does not detect stray parameters
-
- Resolved
-
[JENKINS-28828] echo step prints null when passed a non-String (was: cannot access envVars from RunWrapper)
Summary | Original: It is not possible to access the build env vars from a RunWrapper | New: echo step prints null when passed a non-String (was: It is not possible to access the build env vars from a RunWrapper) |
Summary | Original: echo step prints null when passed a non-String (was: It is not possible to access the build env vars from a RunWrapper) | New: echo step prints null when passed a non-String (was: cannot access envVars from a RunWrapper) |
Summary | Original: echo step prints null when passed a non-String (was: cannot access envVars from a RunWrapper) | New: echo step prints null when passed a non-String (was: cannot access envVars from RunWrapper) |
Workflow | Original: JNJira [ 163688 ] | New: JNJira + In-Review [ 181338 ] |
Component/s | New: pipeline-general [ 21692 ] |
Component/s | Original: workflow-plugin [ 18820 ] |
Link |
New:
This issue is related to |
Component/s | New: workflow-cps-plugin [ 21713 ] | |
Component/s | Original: pipeline [ 21692 ] |