结合使用通配符的过滤条件时,Jenkinsfile copyartifact无法找到工件

时间:2019-05-17 02:37:33

标签: jenkins jenkins-pipeline branch

我有2个工作,使用2个不同的jenkinsfile。 作业可以使用以下命令正确生成工件:

post {
      always {
          mstest testResultsFile:"testresults*.trx", keepLongStdio: true
          archiveArtifacts artifacts: 'from/path/Deploy/**/*.*', fingerprint: true

我在另一份工作中使用这些工件,并复制:

        steps {          
          step([$class: 'CopyArtifact', fingerprintArtifacts: true, flatten: true, projectName: 'branch/name', selector: lastSuccessful(), filter: "webpackage.*", target: './artifacts'])

在没有“过滤器”条件的情况下运行时,将复制所有工件。当我如上所述使用“过滤器”时,出现此错误:

ERROR: Failed to copy artifacts from branch/name with filter: webpackage.*

Jenkins和代理正在Windows SO上运行。 我应该不同地指定路径吗?

1 个答案:

答案 0 :(得分:1)

根据文档CopyArtifact使用蚂蚁表达式语法。因此,这可能在路径上起作用。我也跳过点。

    steps {          
      step([$class: 'CopyArtifact', fingerprintArtifacts: true, flatten: true, projectName: 'branch/name', selector: lastSuccessful(), filter: "**/webpackage*", target: './artifacts'])