如何在Jenkins管道中使用Artifactory插件设置现有工件属性

时间:2018-07-27 14:25:37

标签: jenkins-pipeline artifactory

目标: 使用声明性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
                }
            }
        }
    }
}

0 个答案:

没有答案