itgeek
itgeek

Reputation: 589

How to upload multiple artifacts(.zip) to different targets in arifactory using Jenkins pipeline script

How to upload multiple maven artifacts(.zip) to different targets in Jfrog Artifactory using Jenkins pipeline script

Upvotes: 0

Views: 1930

Answers (2)

Sam
Sam

Reputation: 2882

If your using the Jenkins artifactory plugin, this grants access to the Jfrog Cli which enables use of uploadSpec and downloadSpec. (Artifactory.server name is configured under jenkins global settings after installing artifactory plugin)

def server = Artifactory.server 'artifactory'
def uploadSpec = """{
                     "files": [
                                {
                                "pattern": "*-file-1.zip",
                                "target": "location1/1"
                                },
                                {
                                "pattern": "*-file-2.zip",
                                "target": "location2/2"
                                }
                            ]
                        }"""
def buildInfo = server.upload(uploadSpec)

More info on filespecs available on their website https://www.jfrog.com/confluence/display/RTF/Using+File+Specs

Upvotes: 2

J Fabian Meier
J Fabian Meier

Reputation: 35795

You can use the Maven deploy:deploy-file goal (http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html) to upload arbitrary files.

Upvotes: 0

Related Questions