Explanation

ARTIFACTORY: How to Use JFrog CLI in Jenkins Using JFrog Plugin

AuthorFullName__c
Afeef Khateeb
articleNumber
000005814
ft:sourceType
Salesforce
FirstPublishedDate
2023-07-13T10:17:31Z
lastModifiedDate
2023-07-13
VersionNumber
8

In the above example we are uploading and downloading generic files. as follows 

tools {
        jfrog 'jfrog-cli-latest'
    }

 

Means that we are defining a new tool called jfrog-cli-latest to download it from release.jfrog.io, which is going to be defined in the coming section. 

Next we will start by defining a stage in Jenkins, which is a Testing stage, and then inserting commands which are JFrog CLI commands. Each command has a description besides it 
 

stages {
        stage ('Testing') {
            steps {
		   #Show the version of JFrog CLI used 
                jf '-v' 
		   #Show the configuration used to connect to JFrog Platform 
                jf 'c show'
		   #in this command we are pinging the artifactory to see if it is alive 
                jf 'rt ping'
		   #In this command we are creating a new file 
                sh 'touch test-file'
#In this command we are adding the new file created previously inside the my- repo repository 
                jf 'rt u test-file my-repo/'
             	   #Publish the build-info into Artifactory.
   jf 'rt bp'
   #Download the test-file
                jf 'rt dl my-repo/test-file'

            }
        } 
    }
}