jenkins Poststep archiveArtifacts:如何从其他机器检索文件?

svmlkihl  于 8个月前  发布在  Jenkins
关注(0)|答案(1)|浏览(83)

我运行一个Jenkins管道,它使用agent.jar在一个(总是相同的)虚拟机上执行作业。
这些作业在VM-workspace目录中生成工件,这些文件被成功传输到Jenkins。
现在我想让管道也从VM-workspace中检索数据。如何配置“archiveArtifacts”来访问我的VM?

eqqqjvef

eqqqjvef1#

这对我来说很有效:在作业配置中激活“允许复制工件的权限”“允许复制工件的项目”:*
在作业配置中,Post build actions,Archive the artifacts,Files to archive:result.html
在管道脚本中:

stage("foo-stage") {
            steps {
                script {
                    catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE', catchInterruptions: false) {
                        timeout(time: 5, unit: 'MINUTES') {
                            String jobName = "foo-job"
                            String artifactsFilter = "*.html"
                            result = build job: jobName
                            copyArtifacts filter: artifactsFilter, projectName: jobName , selector: specific("${result.number}")
                            archiveArtifacts artifacts: artifactsFilter
                        }
                    }
                }
            }
        }

字符串

相关问题