我在下面配置了一个环境变量:
Manage Jenkins -> Configure System -> Global properties.
我可以在我的工作中使用环境变量,但我似乎找不到使用 API 远程查询它的方法。
它是否显示在任何地方?
最佳答案
我们正在像这样设置全局环境:
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()
}
所以你应该能够以相同的方式阅读它们,但不是通过 api,找不到方法。
关于java - 使用 API 查询 Jenkins 全局属性中定义的环境变量值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40572254/