[英]How to get the list of the environment variable from the jenkins in the test case
我正在為插件創建一個測試用例,我想獲取當前 Jenkins 服務器上存在的所有環境變量。 誰能告訴我如何從 Jenkins 服務器獲取所有環境變量?
public class VariableExistsConditionTest {
@Rule public JenkinsRule j = new JenkinsRule();
@Test
public void someTest() throws IOException, InterruptedException {
EnvironmentVariablesNodeProperty prop = new EnvironmentVariablesNodeProperty();
EnvVars env = prop.getEnvVars();
env.put("DEPLOY_TARGET", "staging");
j.jenkins.getGlobalNodeProperties().add(prop);
//Code to fetch the environment variables
}
獲取所有環境變量使用
Map<String, String> env = System.getenv();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.