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

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

问题描述

我已将 Jenkins 设置为运行并发构建,因此我最终得到了工作区、工作区@2、工作区@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:

  • (如果尚未启用,则启用这是一个参数化构建")
  • 添加选择参数"类型的参数并将其命名为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天全站免登陆