如何在Jenkins中使用filespecs动态创建文件夹并在Jfrog人工制品中上传人工制品? [英] How to create folders dynamically and upload artifacts in Jfrog artifactory using filespecs in Jenkins?

查看:333
本文介绍了如何在Jenkins中使用filespecs动态创建文件夹并在Jfrog人工制品中上传人工制品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jenkins中有一个构建工作,它可以从github为任何分支构建项目.软件包将在构建作业工作区中创建,版本为xxxx-yyyyy-2.15.0-SNAPSHOT.zip.

I have a build job in jenkins which builds the project from github for any branch. package will be created in build job workspace with the version as xxxx-yyyyy-2.15.0-SNAPSHOT.zip.

我的下一个工件推送作业的文件规格如下:

My next artifactory push job has filespec written as below:

{ 
 "files": [
       {
           "pattern": "/var/lib/jenkins/workspace/Jobname/target/*/xxxx-yyyyy*.zip",
           "target": "libs-snapshot-local/xxxx-yyyyy/",
           "recursive": "false"
       }
    ]
}

以上的文件规范识别出该模式,并将zip压缩文件上传到libs-snapshot-local/xxxx-yyyyy/中.但是我需要上传文件,并使用在zip文件xxxx-yyyyy-2.15.0-SNAPSHOT.zip中可用的版本名称创建文件夹.

Above filespec recognize the pattern and upload the zip in libs-snapshot-local/xxxx-yyyyy/. But I need to upload the file with folder created with version name available on the zip file xxxx-yyyyy-2.15.0-SNAPSHOT.zip.

有人可以帮助我动态创建一个带有版本名称的文件夹吗?关于如何在filespec中指定目标路径的任何想法?

Can anybody help me to create a folder dynamically with version name? any idea on how to specify target path in filespec?

推荐答案

文件规范可以使用

The file specs has the ability to use placeholders in order to create more flexible paths.
For example in your case:

{ 
 "files": [
       {
           "pattern": "/var/lib/jenkins/workspace/Jobname/target/*/(xxxx-yyyyy*).zip",
           "target": "libs-snapshot-local/{1}/",
           "recursive": "false"
       }
    ]
}

请注意模式中的括号和目标中使用的占位符{1}.

Please pay attention for the parentheses in the pattern and the placeholder marker {1} used in the target.

这篇关于如何在Jenkins中使用filespecs动态创建文件夹并在Jfrog人工制品中上传人工制品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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