保留Jenkins工作区 [英] Preserve Jenkins workspace

查看:306
本文介绍了保留Jenkins工作区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了Jenkins来运行并发构建,因此最终得到了工作区,workspace @ 2,workspace @ 3等.如果Jenkins认为构建已完成,则新的构建将覆盖工作区.有没有一种方法可以防止这种情况发生?例如.除非我说,否则不要覆盖workspace @ 3. 我们在各种情况下都非常有用.

I have Jenkins set up to run concurrent builds, so I end up with workspace, workspace@2, workspace@3, etc. If Jenkins thinks the build is finished, a new build will overwrite the workspace. Is there a way of occasionally preventing that? E.g. Don't overwrite workspace@3 until I say. We have various scenarios where this would be very useful.

推荐答案

您可以在构建结束时简单地归档整个工作区.作业删除后,它将被删除.

You could simply archive the complete workspace at the end of a build. It would then get deleted when the job is deleted.

要这样做:

  • 添加构建后操作->存档工件"
  • 输入**作为要归档的文件"
  • Add post-build action -> "Archive the artifacts"
  • Enter ** as "Files to archive"

如果要使每次运行都可配置,则可以创建一个构建参数:

If you want to make that configurable per run, you could create a build parameter:

  • (如果尚未启用,请启用这是参数化的版本")
  • 添加类型为"Choice Parameter"的参数并将其命名为ARCHIVE
  • 选择为<blank line>**(字面上,在第一行中留空,然后第二行恰好是**.无引号)
  • 在存档工件"操作的高级"设置中,将${ARCHIVE}用作要存档的文件"
  • 启用复选框如果归档不返回任何内容,则构建不会失败"
  • (enable "This is a parametrized build" if not yet enabled)
  • add parameter of type "Choice Parameter" and name it ARCHIVE
  • with choices being <blank line> and ** (literally, put a blank first line, then second line is exactly **. No quotes)
  • use ${ARCHIVE} as "Files to archive" in "Advanced" setting of "Archive the Artifacts" action
  • enable checkbox "Do not fail build if archiving returns nothing"

这篇关于保留Jenkins工作区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆