目标: 使用声明性Jenkins流水线从Artifactory下载一个构件,运行测试,并根据测试结果设置Artifactory中构件的属性值。
问题所在: 如何在Jenkins流水线中使用Artifactory插件设置现有构件的属性?
部分代码:
pipeline {
stages {
stage("Load") {
steps {
// Get the firmware from Artifactory
script {
def artServer = Artifactory.newServer url: '~~~'
def downloadSpecInline = """{
"files": [
{
"pattern": "${artRepo}/*thing-*${artBuildNo}*-class.zip",
"recursive": "true",
"flat": "true"
}
]
}"""
def artifactBuildInfo = artServer.download(downloadSpecInline)
// Unknown part
doSomeTest()
artifactBuildInfo.setProperty qa.level, awesome
}
}
}
}
}