Jenkins Artifactory插件-获取最新工件 [英] Jenkins Artifactory plugin - grabbing latest artifacts

查看:155
本文介绍了Jenkins Artifactory插件-获取最新工件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试保存构建工件,并通过Jenkins Artifactory插件的上载/下载规范部分将其拉入新的构建. 有没有办法抓住最新的"构建工件?

I am trying to save build artifacts and pull them into new builds via the upload/download spec portion of the Jenkins Artifactory plugin. Is there a way to grab the "latest" build artifacts?

我在人工文件规范文档中看到在下载规范中应该有一个"build"元素,我可以在其中指定"LATEST",但这是行不通的,只是说找不到"LATEST".也许我一开始没有将我的作品正确地发布到Artifactory?

I see in the Artifactory file spec docs that there should be a "build" element in the download spec where I can specify "LATEST" but that doesn't work, just says "LATEST" not found. Maybe I am not publishing my builds to Artifactory correctly in the first place?

根据此SO问题

According to this SO question and this GitHub page it appears that sorting by date and grabbing the newest is only supported with the jfrog CLI and not in Jenkins. Others told me that this sort of functionality can be had using the name setter, version number, description setter plugings... but that seems really hacky.

我们正在使用Jenkins 2.60.3和Artifactory Enterprise 5.4.5.

We are using Jenkins 2.60.3 and Artifactory Enterprise 5.4.5.

推荐答案

如果我使用的是"aql",我根本无法使它正常工作,但是使用模式"来查找文件时,它却可以工作.当指定"build"时,即使您指向的存储库中有一堆类似名称的文件(Artifactory中的构建元数据会解决此问题),它也只会抓住该构建的工件.如果不指定"build",它将捕获所有匹配的工件.

I could not get this to work at all if I was using "aql", but it works when using "pattern" to find the file(s). When "build" is specified it will grab that build's artifacts only, even if the repo you're pointing at has a bunch a similarly named files (the build metadata in Artifactory takes care of this I guess). Without specifying "build" it would grab all of the matching artifacts.

内部版本"应采用内部版本名称/内部版本号格式,但是您可以不使用数字,也可以使用LATEST来获取最新的成功内部版本的工件(我对此进行了测试创建失败的版本).

"build" should be in the build-name/build-number format, but you can leave off the number OR use LATEST in order to grab the latest successful build's artifacts (I tested this by creating a failed build).

示例说明:
-这会将file3下载到Dependencies/file3
-删除"/LATEST"也将仅下载file3
-删除整个构建"行将下载所有3个文件

Example to illustrate:
- This will download file3 to Dependencies/file3
- Removing "/LATEST" will also download only file3
- Removing the whole "build" line will download all 3 files

# Artifactory Repo: example-repo/  
# BuildName: example-build
#   example-repo/file1  (from build 1)   
#   example-repo/file2  (from build 2)   
#   example-repo/file3  (from build 3)

Download File Spec:
{
    "files": [
        {
            "pattern": "example-repo/file*",
            "target": "Dependencies/",
            "recursive": "false",
            "flat" : "true",
            "build" : "example-build/LATEST"
        }
    ]
 }

这篇关于Jenkins Artifactory插件-获取最新工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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