[ACCEPTED]-How to set Jenkins environment variable from script-jenkins-plugins
Accepted answer
Add a build step to execute shell - in there 5 determine APP_BUILD_NUMBER
and output to file, e.g.
APP_BUILD_NUMBER=$(curl --request GET 'https://api.domain.com/api/GetBuildNumber')
APP_BUILD_NUMBER=$((APP_BUILD_NUMBER +1))
echo APP_BUILD_NUMBER=$APP_BUILD_NUMBER > build.properties
then 4 add build step Inject environment variables and set there Properties File Path to $WORKSPACE/build.properties
after 3 that $APP_BUILD_NUMBER
is accessible in all build steps after 2 as environment variable; e.g. in Xcode build 1 step
These are also worth considering
- https://wiki.jenkins-ci.org/display/JENKINS/Environment+Script+Plugin.
- https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.