Set variable in properties file based on a choice build param
-
12-12-2019 - |
سؤال
We are in the process of setting up a Jenkins CI server to handle all of our WebDriver tests. Ideally, I would like to have choice build parameters for our QA team to select the server to test (production, etc.) for each build. We have a properties file in place to handle this, so we only need to make changes to that file. Are there any plugins out there that can do what we are looking for?
المحلول
Yes, EnvInject Plugin can read environment from a property file and make it available to the build.
نصائح أخرى
You could just use a shell build step
echo $MY_BUILD_VAR > $WORKSPACE/somefile
sometimes a plugin is more than you need! (though EnvInject would help if you have a mixture of OSes to support (i.e. *nix and windows) as Windows runs batch files and *nix goes with shell... though the windows version is trivially different
echo %MY_BUILD_VAR% > %WORKSPACE%\somefile