请阅读评论以了解问题 .
job(buildV2PerfTest) {
displayName('Performance Test')
steps {
//I am loading a value into a properties file using the shell command. The name of the variable is callbackUrl
shell('echo "callbackUrl=http://`curl http://169.254.169.254/latest/meta-data/public-hostname`:8080" > env.properties')
//then I add the propeties file to Jenkins properties
environmentVariables {
propertiesFile('env.properties')
}
maven {
goals('-P performance test')
//I want to pass to maven a loaded property here
property('callbackUrl', "${callbackUrl}")
}
}
}
问题是,当我编译此代码时,它表示该属性不存在 . 确实 . 当我触发工作时它将存在 . 我想知道如何引用动态属性 .
附: documentation告诉如何加载变量,但未解释如何访问它们
1 回答
解决方案是: