Search code examples
jenkinscontinuous-integrationjfrog-cli

How to execute jFrog CLI in Jenkins?


I am using Jenkins for CI/CD and want to download some artifactory using jFrog command line. I know some of the commands of jFrog by which I can get the artifacts but I want to do it through Jenkins. Can anybody help me how can I accomplish it through Jenkins?

Many thanks!


Solution

  • This is really easy if you use pipeline in jenkins, and of course you need to install artifactory plugin.

    Here is a snippet on how to download from the docs:

    def downloadSpec = """{
     "files": [
      {
          "pattern": "bazinga-repo/*.zip",
          "target": "bazinga/"
        }
     ]
    }"""
    

    Of course only this will not do it. You need to have credentials setup first (in jenkins credentials), and then also (in pipeline) define server and everything needed. There are also maven examples there since you've mentioned that it is what you use.

    Info on jenkins pipeline can be found here.