Jenkins项目工件和工作区 [英] Jenkins Project Artifacts and Workspace

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

问题描述

我使用詹金斯已有很多年了,但是我从来没有自己设置过,就像我在新工作中所做的那样.我遇到了几个问题.

I've used jenkins for quite a few years but have never set it up myself which I did at my new job. There are a couple questions and issues that I ran into.

默认工作区位置-似乎最新的Jenkins在Jenkins \ jobs [projectName] \ workspace中具有默认工作区,并且每次构建都被覆盖(或清除(如果选择)).我认为应该将其放置在Jenkins \ jobs [projectName] \ builds [build_id] \中,以便能够为每个构建存储工作区状态以供将来参考?

Default workspace location - It seems like the latest Jenkins has the default workspace in Jenkins\jobs[projectName]\workspace and is overwritten (or wiped if selected) for every build. I thought that it should instead be in Jenkins\jobs[projectName]\builds[build_id]\ so that it would be able to store the workspace state for every build for future reference?

在项目上的显示工作空间> Build_ID页面-这与以前的工作一样,因为我希望以前的版本的每个工作空间"都将在此处显示.目前,在我的设置中,该单独页面除了Git修订版以及什么版本库更改触发了构建之外,什么都没有给您.以及控制台输出.文物在哪里?使用该版本工作空间的链接在哪里?

Displaying workspace on the project>Build_ID page - This goes along with the previous as I expected each 'workspace' for previous builds to show here. Currently in my setup this individual page gives you nothing except the Git revision and what repo changes triggered the build. As well as console output. Where are the artifacts? Where is the link to this build's workspace that was used?

在构建中归档工件-选择工件时,该过滤器似乎不起作用.我的构建创建了一个文件结构,其中包含工作区中的工件.我想存储它,工件过滤器说它开始于工作空间.所以我放入了工件",没有东西得到存储(这将存储在什么地方?).我也尝试过'/artifacts'和'artifacts/*'.

Archiving Artifacts in builds - When choosing artifacts, the filter doesn't seem to work. My build creates a filestructure with the artifacts in it inside workspace. I want to store this and the artifacts filter says it starts at workspace. So I put in 'artifacts' and nothing gets stores (also where would this get stored?). I have also tried '/artifacts' and 'artifacts/*'.

任何帮助都会很棒!谢谢!

Any help would be great! Thanks!

推荐答案

您似乎对詹金斯的几个方面感到困惑..我认为您的问题基本上可以归结为以下几个方面.

It does seem like you are confused about several aspects of Jenkins.. I think your question basically boils down to the following.

工作空间和构建之间有什么区别?

因此,这是有关此主题的一些想法:

So, here are some thoughts on this topic:

  1. 建筑是历史数据.它们(通常)不会像构建/结帐期间的工作空间那样发生变化.
  2. 内部版本包含有关运行的信息(例如其状态,内部版本号,更改日志等)以及您要求其存档的任何工件(日志,测试结果等)的信息.它们(通常)不包含工作空间之类的源代码.
  3. 内部版本存储在Jenkins\jobs\[projectName]\builds\[build_id]\目录中.这是由詹金斯(Jenkins)管理的目录,您(通常)不需要修改此目录中的任何内容.但是,工作空间是用于构建的目录,您几乎可以对它们进行任何操作并将它们放置在任何位置(它不必位于默认的Jenkins\jobs\[projectName]\workspace目录中.
  4. 工作区应该能够在任何给定时间被擦除.要还原它,只需使用相同的参数/修订版来重建作业.如果您需要在构建后保留某些内容,请在构建完成之前告诉Jenkins将其存档.
  5. 关于保存整个状态,我认为您不需要这样做.如#4所述,您应该能够通过启动与所讨论的构建相同的修订/参数来复制相同的构建.如果您无法从相同的修订版/参数恢复到原始状态,则可能需要努力进行调试,因为调试将是一场噩梦. :)
  6. 工作空间是项目的一个方面,而不是内部版本,因​​此,该页面没有指向工作空间的链接.同样,构建只是保存来自先前运行的数据.项目使用工作空间来构建内容,这就是为什么您可以从该页面进入工作空间的原因.
  7. 关于如何保存工件,您必须指定要保存的文件的名称.除非您试图保存一个名为工件"的文件,否则您可能应该使用其他东西.所有日志文件的**/*.log怎么样?或**/*.xml用于所有xml文件?
  1. Builds are historical data. They (usually) don't change like a workspace does during building/checkout.
  2. Builds contain information about a run (e.g. its status, build number, change log, etc) and any artifacts that you tell it to archive (logs, test results, etc). They (usually) don't contain source code like a workspace.
  3. Builds are stored in the Jenkins\jobs\[projectName]\builds\[build_id]\ directory. This is a directory managed by Jenkins and you (usually) do not need to modify anything in this directory. However, workspaces are directories meant for the build and you can do pretty much anything with them and place them anywhere (it does not need to be in the default Jenkins\jobs\[projectName]\workspace directory.
  4. Workspaces should be able to be wiped at any given time. To restore it, just rebuild the job with the same parameters/revision. If you need to keep something after a build, tell Jenkins to archive it before the build is done.
  5. In regard to saving the entire state, I don't think you need to do that. As mentioned in #4, you should be able to reproduce the same build by kicking off the same revision/parameters as the build in question. If you cannot get back to the original state from the same revision/parameters, then that might be something to strive for as debugging is going to be a nightmare. :)
  6. A workspace is an aspect of the project and not a build and that is why there is no link to the workspace from that page. Again, a build is just saved data from a previous run. A project uses the workspace to build stuff and that is why you can get to the workspace from that page.
  7. In regard to how to save artifacts, you must specify the names of the files you want to save. Unless you are trying to save a file called "artifacts", then you should probably use something else. How about **/*.log for all log files? or **/*.xml for all xml files?

希望这会有所帮助.

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

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