我有一个 Jenkins 管道作业,在第一阶段归档工件,然后我需要在管道构建的另一个阶段复制该工件
node {
stage 'Stage 1 of build'
// Run tests, if successful archive the artifact
archiveArtifacts artifacts: 'build/test.js', excludes: null
stage 'Stage 2 of build'
// want to copy artifact from stage 1 of the build
step([$class: 'CopyArtifact', filter: 'build/test.js', fingerprintArtifacts: true, flatten: true, projectName: 'echo-develop-js-pipeline', selector: [$class: 'WorkspaceSelector'], target: './client/public/vendor/echo/'])
}
有了这个我得到了unable to find a build for artifact copy
创建工件后,它将保存在此处:
http://localhost:8181/view/Echo JS Develop/job/echo-develop-js-pipeline/233/artifact/build/test.js
如何从管道作业中访问创建的工件?
我最近需要这个,这里的其他解决方案都没有完全满足我的要求,因为我需要使用多个参数过滤器供我选择。这是我使用“运行选择器插件” 除了直接调用“复制神器插件":
第一步:选择您需要的版本号。
prereq_build = selectRun filter: parameters("TARGET_OS=${TARGET_OS},GIT_BRANCH_NAME=${GIT_BRANCH_NAME}"), job: 'prereq_rpms', selector: status('STABLE'), verbose: true
第二步:复制(2017 年 11 月更新:现在支持本机管道!).
copyArtifacts(
projectName: 'prereq_rpms',
filter: '**/*.rpm',
fingerprintArtifacts: true,
target: 'prereq',
flatten: true,
selector: specific(prereq_build.getId())
)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)