Chanafot
Chanafot

Reputation: 796

choose artifact from artifactory to deploy pipeline job in Jenkins

Is this possible? Suppose I have 2 jobs. One for building artifact and upload it to artifactory with latest version. And another job to deploy the artifact to the server. But I would like to choose the artifact version. Supose A deploy was made and not working , so I redeploy and choose previous artifact (or the one I want to choose). Is this posible in jenkins in a pipleine project? Like a parametrized build or something like that.

Thanks

enter image description here

enter image description here

Upvotes: 1

Views: 4867

Answers (2)

Samy
Samy

Reputation: 632

It will work with the pipelin job . I am it in pipeline job only.

Example: https://wiki.jenkins.io/display/JENKINS/Maven+Metadata+Plugin

  1. Assume that you have 2 jobs .

  2. Job A & Job B. (Both pipeline jobs.)

         Job A -> Build and push the artifacts to Artifactory. 
         Job B -> Fetch the artifact from Artifactory and deploy.
    
    1. Install the Maven Meta Plugin . https://wiki.jenkins.io/display/JENKINS/Maven+Metadata+Plugin
    2. go to Job B
      1. "This build is parametrerized" checkbox, from the drop-down that appears select the "List maven artifact versions",
        configure the artifact you want to retrieve the versions
      2. Name the parameter as deploy_version
    3. In Job B - > Select the version & Click Build.
    4. In pipeline script receive the selected version as param.deploy_version.
    5. Since you know the artifact version and artifact URLs . You can use CURL/httprequest plugin in Jenkisn to download the necessary
      artifact from Artifactory (I am using Maven Ansible artifactory
      plugin to download)
    6. Continue with your deployment.

Upvotes: 1

JRichardsz
JRichardsz

Reputation: 16524

According to this answer :

https://stackoverflow.com/a/34781604/3957754

The artifactory plugin for Jenkins has the option to "resolve" artifacts, i.e. download them from Artifactory. But this may require the Pro version with payment $_$

Download artifact using artifactory jenkins plugin (With Payment)

Download artifact using commandline and maven

Source: How can I download a specific Maven artifact in one command line?

Upvotes: 0

Related Questions