I would like to retrieve a custom variable from a successful last stable build jenkins job. I was able to retrieve the build number using curl on this link using Execute Shell. It's an internal server. https://jenkinsci.internalsvr/view/webapps/job/common-tools/lastStableBuild/buildNumber
Now, I'd like to do the same for a custom variable using curl. But I know that I may need to save the value of the custom variable but not sure how and to where.
So this is how I got it to work
I have this code in our dsl.groovy file
So if I need to access it, the http url should be formed like this
You can do it with the API of the EnvInject plugin, either with:
More info here.