In FreeStyle Project, I have lots of env vars, which are available from any part of Jenkins' job. I also used ghprb plugin to trigger that job against GH PRs, which added some extra env vars.
Later, that job became more complex, so I've decided to put it on Jenkins Pipeline. But now, the issue is, I can't retrieve those env vars in a pipeline, which were available before, in the Freestyle Project.
I'm a newbie in writing Jenkins Pipeline, that's why I decided to use declarative approach for that purpose (but I don't think it's root cause). So, my question is, how to retrieve env vars in Jenkins Pipeline, such as: ${BUILD_CAUSE}
, ${ghprbTargetBranch}
, ${ghprbActualCommitAuthorEmail}
?
if [ $BUILD_CAUSE == MANUALTRIGGER ]; then exit 0 fi NC=$(git merge-base HEAD remotes/origin/$ghprbTargetBranch)
${BUILD_CAUSE}
instead of$BUILD_CAUSE