CopyArtifact在詹金斯管道中不起作用

时间:2019-08-27 11:43:38

标签: jenkins-pipeline jenkins-plugins jenkins-groovy

CopyArtifact在jenkins管道中失败,并显示以下错误:

"[Pipeline] End of Pipeline
ERROR: Failed to copy artifacts from upstreamjob with filter: *.txt Finished: FAILURE"

在尝试在下游作业中复制上游作业的工件时,我遇到以下问题。我正在使用https://plugins.jenkins.io/copyartifact

中建议的声明性管道脚本

上游作业(upstreamjob1):

pipeline {
    agent {
        label "Test_Node_3"
    }
    stages {
        stage('No-op') {
            steps {
                sh '''
                mkdir test
                cd test
                touch abc.txt
                '''
            }
        }
    }
    post {
        always {
            echo 'One way or another, I have finished'
        }

        success {
                build job: 'downstreamjob2'
        }

        unstable {
            echo 'I am unstable :/'
        }
        failure {
            echo 'I failed :('
        }
        changed {
            echo 'Things were different before...'
        }
    }
}

下游工作(downstreamjob2):

pipeline {
    agent {
        label "Test_Node_2"
    }
stages {
     stage('Copy Archive') {
         steps {
    copyArtifacts fingerprintArtifacts: true, projectName: 'upstreamjob1', 
    selector: workspace(), filter: 'abc.txt', target: 'test'
         }
     }
  }
}

工件应从上游作业复制到下游作业。

0 个答案:

没有答案