繁体   English   中英

如何从测试用例中的jenkins获取环境变量列表

[英]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.

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