How to create folders dynamically and upload artifacts in Jfrog artifactory using filespecs in Jenkins?

淺唱寂寞╮ 提交于 2019-12-13 15:29:36

问题


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"
       }
    ]
}

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.

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


回答1:


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"
       }
    ]
}

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



来源:https://stackoverflow.com/questions/45010177/how-to-create-folders-dynamically-and-upload-artifacts-in-jfrog-artifactory-usin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!