简体   繁体   English

Jenkins 升级步骤如何管理工作空间

[英]How does Jenkins promotion step manage workspaces

This is a Jenkins 101 question... I'm writing a Jenkins Promotion script which copies files from my workspace to a git repository.这是一个 Jenkins 101 问题...我正在编写一个 Jenkins 升级脚本,它将文件从我的工作区复制到 git 存储库。 Currently my promotion process isn't doing a rebuild.目前我的晋升过程没有重建。 My question is how does Jenkins manage the workspace?我的问题是 Jenkins 如何管理工作区? If I have two builds in Jenkins build #1 and build #2.如果我在 Jenkins 构建 #1 和构建 #2 中有两个构建。 Assuming build #2 was done last, if I go to promote build #1 will the workspace have build #2 files in it or will Jenkins somehow switch back to the workspace from build #1 (with my build artifacts still intact from the build step).假设构建 #2 是最后完成的,如果我 go 来提升构建 #1 工作区是否会有构建 #2 文件,或者 Jenkins 会以某种方式从构建 #1 切换回工作空间(我的构建工件在构建步骤中仍然完好无损)。

So the question boils down to whether Jenkins does some magic to make this work for me or if this is something I need to handle myself.所以问题归结为 Jenkins 是否为我做了一些魔法,或者这是我需要自己处理的事情。

One approach to get the artifacts from specific builds is to use the copy artifact plugin - it allows you to specify which build artifact you want to grab.从特定构建中获取工件的一种方法是使用复制工件插件- 它允许您指定要获取的构建工件。

Just note that to keep the artifacts, you need to archive them on your build jobs.请注意,要保留工件,您需要将它们 存档在构建作业中。

About the workspace management, I think it really depends on your configuration, because both approaches are possible.关于工作空间管理,我认为这真的取决于您的配置,因为这两种方法都是可能的。 By default, I believe it uses the same, but imagine that you have concurrent builds, Jenkins will create folders such as workspace@2 and so on... Best approach is to use the artifacts that are archived during the build, and do not care bout the workspace management.默认情况下,我相信它使用相同的,但假设您有并发构建,Jenkins 将创建文件夹,例如 workspace@2 等等......最好的方法是使用在构建过程中存档的工件,而不是关心工作区管理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM