Jenkins 等待工件下载完成

Jenkins wait for artifact download to finish

所以我正在使用 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?

下面为我下载 2 个工件:

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 
...
}