I'm setting some environment variables by some windows batch commands in the pre-build steps for a Jenkins build. I need to use these variables for a few java selenium test cases which will run during as part of the build.
set HD_KF_TC_IN_LOOK_UP_KET_FEATURE_XLS = %WORKSPACE%\selenium_input_files\Key_Features\en_US
I have tried to retrieve these environment variable values by using
System.getEnv(HD_KF_TC_IN_LOOK_UP_KET_FEATURE_XLS) commands. But this is not working as the values for these variables is always
Please let me know where I'm I going wrong?Answer1:
As indicated in my comment, I do not completely understand your setup. In general, however, environment variables set in one Jenkins build step do not propagate outside of it and can't be accessed from other build steps. You need to use <a href="https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin" rel="nofollow">EnvInject plugin</a> to achieve that.