简体   繁体   中英

Jenkins: How to set environment variables for ant task by “source script”

Imagine a classic set_env.sh shell script which exports some environment variables which contents are calculated (non-static, depending on the file system).

In Jenkins , I'd like to execute this shell script and afterwards calling an ant build step using the previous environment from the script .

Is there a way to do that in jenkins?

Another way would be to use the Envinject plugin. This lets you "inject" environment variables from a file so that they become part of the build environment, usable by all build steps.

You'll need to source the script, as in

. set_env.sh

That way, variables it exports are available in subsequent shell commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM