我正在开发基本的 Jenkins 管道。构建和测试成功,但我正在研究如何存档构建。对于上下文,这是一个简单的 Rust Web 服务器。
根据pipeline steps Basic Steps 插件中的文档,它具有archive
功能。但它说:
Archives build output artifacts for later use. As of Jenkins 2.x, you may use the more configurable
archiveArtifacts
.
我找不到有关 archiveArtifacts
的任何文档。有一些示例,但我想查看它的文档,它接受哪些参数,即什么使它比 archive
更可配置。
我的问题:是否有最好的地方可以找到此文档? jenkins.io不完整且 wiki.jenkins.io缺少这个命令。
最佳答案
我建议archiveArtifacts: Archive the artifacts来自Pipeline Steps Reference .
Archives the build artifacts (for example, distribution zip files or jar files) so that they can be downloaded later. Archived files will be accessible from the Jenkins webpage. Normally, Jenkins keeps artifacts for a build as long as a build log itself is kept, but if you don't need old artifacts and would rather save disk space, you can do so.
Note that the Maven job type automatically archives any produced Maven artifacts. Any artifacts configured here will be archived on top of that. Automatic artifact archiving can be disabled under the advanced Maven options.
文物
您可以使用“module/dist/**/*.zip”等通配符。有关确切格式,请参阅 Ant 文件集的 contains 属性。基本目录是工作空间。您只能归档位于您工作区中的文件。- 类型:
字符串
- 类型:
allowEmptyArchive
(可选)
通常,如果归档返回零工件,则构建会失败。此选项允许归档过程不返回任何内容,而不会导致构建失败。相反,构建只会抛出警告。- 类型:
bool 值
- 类型:
排除
(可选)
(可选)指定“排除”模式,例如“foo/bar/**/*”。与此掩码匹配的文件将不会被存档,即使它与“要存档的文件”部分中指定的掩码匹配。- 类型:
字符串
- 类型:
关于jenkins - Jenkins 中 archiveArtifacts 命令的文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47877531/