简体   繁体   English

使用API​​查询在Jenkins全局属性中定义的环境变量值

[英]Query Environment Variables values defined in Jenkins Global Properties using API

I have configured an environment variable under: 我已经在下面配置了一个环境变量:

Manage Jenkins -> Configure System -> Global properties. 管理詹金斯->配置系统->全局属性。

I'm able to use the environment variable in my jobs but I can't seem to find a way to query it remotely using the API. 我可以在作业中使用环境变量,但似乎找不到使用API​​远程查询环境变量的方法。

Is it displayed anywhere? 它显示在任何地方吗?

We are setting global environments like this: 我们正在设置如下这样的全局环境:

for (nodeproperty in hudson.model.Hudson.instance.globalNodeProperties) {
    siteSpecific.global_environment.each {key, value ->
        println "INFO: Adding: ${key}:${value}"
        nodeproperty.getEnvVars().put(key, value)
    }

    hudson.model.Hudson.instance.save()
}

So you should be able to read them the same way, but it not through the api, couldn't find a way for that. 因此,您应该能够以相同的方式阅读它们,但是它不是通过api来找到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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