这是我想要实现的目标。- 我的 Jenkins 工作中有两个“选择参数”。第一个选择参数的值是硬编码的。应根据第一选择列表选择填充第二选择列表。我在 Jenkins 中保存了一个属性文件,其中包含键值对。首选列表中的值和文件中的 Keys 相同。在第一选择列表中选择一个值时,我想要一个代码来读取属性文件并使用与该键对应的文件中的值填充第二选择参数。对于第二选择列表,我正在尝试使用“Active Choice Reactive Parameter”,Referenced parameters= first_choice 和以下 groovy 脚本。但这不会返回任何值。请帮忙!
def firstChoice = [first_choice]
Properties props = new Properties()
def stream = new FileInputStream('C:/Jenkins/books.properties')
try{
props.load(stream)
}
catch (Exception ex){
println "Exception"
}
finally {
stream.close()
}
def values = props.getProperty(firstChoice).split(",")
return values