在 Jenkins 中归档工件 [英] Archive the artifacts in Jenkins

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

问题描述

有人可以向我解释一下构建过程中工件的想法吗?

Could someone please explain to me the idea of artifacts in the build process?

我有工作区目录,我可以在其中查看代码以编译和运行我的 ant 脚本等.最后,就我而言,我得到了一个可以安装的 jar 文件.这算是神器吗?

I have the workspace directory where I check out the code to compile and run my ant scripts etc. At the end, in my case, I get a jar file that's ready to install. Is that considered to be the artifact?

我应该告诉我的构建脚本把 jar 文件放在哪里?在工作区目录中?我的 jar 文件根据 BUILD_ID 等变量获得唯一的文件名,我如何告诉 Jenkins 选择哪个 jar 文件?

Where should I tell my build script to put the jar file? In the workspace directory? My jar file gets a unique filename depending on variables like BUILD_ID and such, how can I tell Jenkins which jar file to pick?

好的,所以我尝试做这样的事情:

Okay, so i tried doing something like this:

该路径在我的工作区中尚不存在,因为构建脚本应该创建它,当然,.jar.properties 文件不是因为它们还没有被生成.为什么它会给我一个错误呢?我好像遗漏了什么.

The path does not exist yet in my workspace, because the build script is supposed to create it, and of course, the .jar and .properties files are not there because they haven't been generated yet. Why does it give me an error then? Seems like I'm missing something.

此外,Jenkins 是否会在每次构建后删除工件(不是存档工件,我知道我可以告诉它删除那些工件)?否则它会很快堵塞硬盘.

Also, does Jenkins delete the artifacts after each build (not the archived artifacts, I know I can tell it to delete those)? Otherwise it will clog the hard drive pretty quickly.

推荐答案

您的理解是正确的,Jenkins 意义上的工件是构建的结果 - 构建过程的预期输出.

Your understanding is correct, an artifact in the Jenkins sense is the result of a build - the intended output of the build process.

一个常见的约定是将构建的结果放入buildtargetbin 目录中.

A common convention is to put the result of a build into a build, target or bin directory.

Jenkins 归档器可以使用 globs (target/*.jar) 轻松获取正确的文件,即使每个构建都有唯一的名称.

The Jenkins archiver can use globs (target/*.jar) to easily pick up the right file even if you have a unique name per build.

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

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