如何在Jenkins multibranch作业中恢复工件?

时间:2017-01-27 20:14:23

标签: maven jenkins hudson

我在Jenkinsfile中编写了两个步骤来保存和恢复工件:

def buildCache    = 'packages-deps.tgz'
//...
stage('Restore cache') {
  unarchive mapping: [(buildCache): buildCache]
  sh "[ -a ${buildCache}  ] && tar xf ${buildCache}"
}

stage('Cache development libraries') {
  sh 'tar czf packages-deps.tgz _build node_modules deps'
  archiveArtifacts buildCache
}

100%的工件是构建和存储的:我可以在构建日志中看到相关的消息

+ tar czf packages-deps.tgz _build node_modules deps
[Pipeline] step
Archiving artifacts

并在分支构建索引页面http://d.pr/i/AHBE.jpg

中归档

但是"还原缓存"步骤失败,出现以下错误:hudson.AbortException: no artifacts to unarchive in packages-deps.tgz

我甚至尝试过通配符unarchive mapping: ['**/.*': '.'],但结果相同:hudson.AbortException: no artifacts to unarchive in **/.*

更新:我的目标是将编译器工件和已获取的依赖项从构建复制到构建,以加快执行时间。用于所有分支的构建。 到目前为止,我们只使用一个节点。

0 个答案:

没有答案
相关问题