詹金斯等待工件下载完成

时间:2020-10-18 17:17:05

标签: jenkins artifactory jfrog

所以我要用jFrog下载多个工件

rtDownload (
serverId: 'Artifactory-1',
spec: '''{
      "files": [
        {
          "pattern": "bazinga-repo/froggy-files/",
          "target": "bazinga/"
        }
      ]
}''',

// Optional - Associate the downloaded files with the following custom build name and build number,
// as build dependencies.
// If not set, the files will be associated with the default build name and build number (i.e the
// the Jenkins job name and number).
buildName: 'holyFrog',
buildNumber: '42'
)

哪个可以工作,但是异步工作,我必须在完成后立即使用结果。我该如何等待管道语法中的每个rtDownload?

1 个答案:

答案 0 :(得分:0)

下面为我下载 2 个 Artifacts :

def target = params.BuildInfo.trim()

def downloadSpec = """{
  "files": [{
    "pattern": "${artifactory}.zip",
    "target": "./${target}.zip"
  }]
}"""

def buildInfo = server.download spec: downloadSpec
def files = findFiles(glob: "**/${target}.zip") // Define `files` here

if (files) { // And verify `it` here, so it'll wait 
...
}