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
Then I only get null. However, it is possible, from the script console to get those variables using
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?