{"id":24234939,"url":"https://github.com/jenkinsci/jfrog-plugin","last_synced_at":"2025-04-09T07:05:58.289Z","repository":{"id":66295737,"uuid":"550237516","full_name":"jenkinsci/jfrog-plugin","owner":"jenkinsci","description":"The Jenkins JFrog Plugin allows for easy integration between Jenkins and the JFrog Platform.","archived":false,"fork":false,"pushed_at":"2025-01-13T08:55:02.000Z","size":2475,"stargazers_count":14,"open_issues_count":27,"forks_count":77,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T06:06:45.497Z","etag":null,"topics":["artifactory","deployment","docker","dotnet","gradle","jenkins","jfrog","jfrog-artifactory","jfrog-cli","jfrog-distribution","jfrog-xray","maven","npm","nuget"],"latest_commit_sha":null,"homepage":"https://github.com/jfrog/jenkins-jfrog-plugin","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenkinsci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-12T12:26:59.000Z","updated_at":"2025-02-25T07:41:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"1117371c-d5f1-48cd-a161-d701e5e632c3","html_url":"https://github.com/jenkinsci/jfrog-plugin","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fjfrog-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fjfrog-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fjfrog-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenkinsci%2Fjfrog-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenkinsci","download_url":"https://codeload.github.com/jenkinsci/jfrog-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994119,"owners_count":21030050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artifactory","deployment","docker","dotnet","gradle","jenkins","jfrog","jfrog-artifactory","jfrog-cli","jfrog-distribution","jfrog-xray","maven","npm","nuget"],"created_at":"2025-01-14T17:38:54.555Z","updated_at":"2025-04-09T07:05:58.265Z","avatar_url":"https://github.com/jenkinsci.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](images/readme/intro.png)](#readme)\n\n\u003cdiv align=\"center\"\u003e\n\n# Jenkins JFrog Plugin\n\n[![Scanned by Frogbot](https://raw.github.com/jfrog/frogbot/master/images/frogbot-badge.svg)](https://github.com/jfrog/frogbot#readme)\n[![Tests](https://github.com/jfrog/jenkins-jfrog-plugin/actions/workflows/tests.yml/badge.svg)](https://github.com/jfrog/jenkins-jfrog-plugin/actions/workflows/tests.yml) [![Static Analysis](https://github.com/jfrog/jenkins-jfrog-plugin/actions/workflows/analysis.yml/badge.svg)](https://github.com/jfrog/jenkins-jfrog-plugin/actions/workflows/analysis.yml)\n\n\u003c/div\u003e\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Installing and configuring the plugin](#installing-and-configuring-the-plugin)\n- [Configuring JFrog CLI as a Tool](#configuring-jfrog-cli-as-a-tool)\n    - [Automatic installation from release.jfrog.io](#automatic-installation-from-releasejfrogio)\n    - [Automatic installation from Artifactory](#automatic-installation-from-artifactory)\n    - [Manual installation](#manual-installation)\n- [Using JFrog CLI in your pipeline jobs](#using-jfrog-cli-in-your-pipeline-jobs)\n    - [Setting the build name and build number](#setting-the-build-name-and-the-build-number)\n    - [Using multiple JFrog Platform instances](#using-multiple-jfrog-platform-instances)\n    - [Publishing and accessing the build-info](#publishing-and-accessing-the-build-info)\n    - [Capturing the output of JFrog CLI commands](#capturing-the-output-of-jfrog-cli-commands)\n- [Using HTTP/s proxy](#using-https-proxy)\n- [Jenkins Configuration as Code](#jenkins-configuration-as-code)\n- [Examples](#examples)\n- [Contributions](#contributions)\n\n## Overview\n\nThe Jenkins JFrog Plugin allows for easy integration between Jenkins and\nthe [JFrog Platform](https://jfrog.com/solution-sheet/jfrog-platform/).\nThis integration allows your build jobs to deploy artifacts and resolve dependencies to and\nfrom [Artifactory](https://jfrog.com/artifactory/), and then have them linked to the build job that created them. It\nalso allows you to scan your artifacts and builds with [JFrog Xray](https://jfrog.com/xray/) and distribute your\nsoftware package to remote locations using [JFrog Distribution](https://jfrog.com/distribution/).\nThis is all achieved by the plugin by wrapping [JFrog CLI](https://www.jfrog.com/confluence/display/CLI/JFrog+CLI). Any\nJFrog CLI command can be executed from within your Jenkins Pipeline job using the JFrog Plugin.\n\n## Installing and configuring the plugin\n\n1. Install the JFrog Plugin by going to\n   **Manage Jenkins | Manage Plugins**.\u003cbr\u003e\u003cimg src=\"images/readme/install-plugin.png\" width=\"70%\"\u003e\n2. Configure your JFrog Platform details by going to\n   **Manage Jenkins | Configure System**.\u003cbr\u003e\u003cimg src=\"images/readme/plugin-config.png\" width=\"30%\"\u003e\n3. Configure JFrog CLI as a tool in Jenkins as described in\n   the [Configuring JFrog CLI as a tool](#configuring-jfrog-cli-as-a-tool) section.\n\n## Configuring JFrog CLI as a tool\n\n### General\n\nTo use JFrog CLI in your pipelines jobs, you should configure it as a tool in Jenkins by going to **Manage Jenkins |\nGlobal Tool Configuration**. You can use one of the following installation options:\n\n### Automatic installation from release.jfrog.io\n\nIf your agent has access to the internet, you can set the installer to automatically download JFrog CLI\nfrom https://releases.jfrog.io as shown in the below screenshot.\n\n\u003cimg src=\"images/readme/automatic-installation.png\" width=\"30%\"\u003e\n\n### Automatic installation from Artifactory\n\nIf your agent cannot access the internet, you can set the installer to automatically download JFrog CLI from the JFrog\ninstance you configured in Manage Jenkins | Configure System as shown in the below screenshot. To set this up, follow\nthese steps:\n\n1. Create a generic remote repository in Artifactory for downloading JFrog CLI. You can name the repository\n   **jfrog-cli-remote**. This is the name we'll be using here, but you can also choose a different name for the\n   repository.\n    * In the **Basic** tab, set the repository URL to `https://releases.jfrog.io/artifactory/jfrog-cli/`\n    * In the **Advanced** tab, uncheck the **Store Artifacts Locally** option.\n\n2. In **Manage Jenkins | Global Tool Configuration** select the Install from Artifactory option as shown in the\n   screenshot below.\u003cbr\u003e\u003cimg src=\"images/readme/automatic-installation-from-rt-1.png\" width=\"30%\"\u003e\n\n3. Set the Server ID of your JFrog instanced, which you configured in **Manage Jenkins | Configure System**. Also set\n   **jfrog-cli-remote** as the name of the remote repository you created to download JFrog CLI from. If you used a\n   different name for repository, set this name\n   here.\u003cbr\u003e\u003cimg src=\"images/readme/automatic-installation-from-rt-2.png\" width=\"30%\"\u003e\n\n### Manual installation\n\nInstall JFrog CLI manually on your build agent, and then set the path to the directory which includes the jf executable,\nas shown in the below screenshot.\n\n\u003cimg src=\"images/readme/manual-installation.png\" width=\"30%\"\u003e\n\n## Using JFrog CLI in your pipeline jobs\n\nTo have your pipeline jobs run JFrog CLI commands, add the following to your pipeline script.\n\n**Step 1:**\nDefine JFrog CLI as a tool, by using the tool name you configured. For example, if you named the tool _jfrog-cli_, add\nthe following to the script:\n\n```groovy\ntools {\n    jfrog 'jfrog-cli'\n}\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eScripted Pipeline\u003c/summary\u003e\n\n```groovy\nwithEnv([\"JFROG_BINARY_PATH=${tool 'jfrog-cli'}\"]) {\n    // The 'jf' tool is available in this scope.\n}\n```\n\n\u003c/details\u003e\n\n**Step 2:**\nUse the **jf** step to execute any JFrog CLI command as follows:\n\n```groovy\n// Upload all files in the target directory to the my-repo Artifactory repository.\njf 'rt u target/ my-repo/'\n```\n\n\u003e **_IMPORTANT:_** Notice the single quotes wrapping the command right after the **jf** step definition.\n\nIf the JFrog CLI command has arguments with white-spaces, you can provide the arguments as a list as follows:\n\n```groovy\njf(['mvn', 'clean', 'install', '-Ddeploy.testProperty=Property with space'])\n```\n\nWhen the above list syntax is used, the quotes required for the string syntax are replaced with quotes wrapping\neach item in the list as shown above.\nThe above step is equivalent to the following shell command:\n\n![bash-spaces.png](images/readme/bash-spaces.png)\n\nThe list syntax also helps avoiding space and escaping problems, when some of those arguments use script variables.\n\n### Setting the build name and the build number\n\nThe plugin automatically sets the following environment variables: _JFROG_CLI_BUILD_NAME_ and _JFROG_CLI_BUILD_NUMBER_\nwith Jenkins's job name and build number respectively.\nYou therefore don't need to specify the build name and build number on any of the build related JFrog CLI commands.\nIf you wish to change the default values, add the following code to your pipeline script:\n\n```groovy\nenvironment {\n    JFROG_CLI_BUILD_NAME = \"my-build-name\"\n    JFROG_CLI_BUILD_NUMBER = \"18\"\n}\n```\n\n### Using multiple JFrog Platform instances\n\nIf you have multiple JFrog Platform instances configured, you can use the `–-server-id` command option with\nthe server ID you configured for the instance. For example:\n\n```groovy\njf 'rt u test-file my-repo –-server-id server-1'\njf 'rt u test-file my-repo –-server-id server-2'\n```\n\n### Publishing and accessing the build-info\n\n[Build-info](https://www.buildinfo.org/) is the metadata of a build. It includes all the details about the build broken\ndown into segments that include version history, artifacts, project modules, dependencies, and everything that was\nrequired to create the build. In short, it is a snapshot of the components used to build your application, collected by\nthe build agent.\nSee below how you publish the build-info from your pipeline jobs. This section should be placed inside the job after the\nexecution of the JFrog CLI commands used for the build.\n\n```groovy\nstage('Publish build info') {\n    steps {\n        jf 'rt build-publish'\n    }\n}\n```\n\nWhen the job publishes the build-info to Artifactory, you can access it by clicking on the build-info icon, next to the\njob run.\n\n### Capturing the output of JFrog CLI commands\n\nThe JFrog CLI commands output is returned as a string.\nTo capture the output of JFrog CLI commands, wrap the JFrog CLI command in a `script` block:\n\n```groovy\nscript {\n    String version = jf '-v'\n    echo \"JFrog CLI version output: $version\"\n}\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eScripted Pipeline\u003c/summary\u003e\n\n```groovy\nString version = jf '-v'\necho \"JFrog CLI version output: $version\"\n```\n\n\u003c/details\u003e\n\n![build-info.png](images/readme/build-info.png)\n\n## Using HTTP/S proxy\n\nIf you're using a JFrog platform that's situated behind an HTTP/S proxy, you should set up your proxy configuration\nunder `Manage Jenkins` \u003e `Manage Plugins` \u003e `Advanced`.\n\nTo exclude the JFrog platform from going through a configured proxy, provide your JFrog platform's host details in\nthe `No Proxy Host` section.\nNotice that the JFrog CLI is typically downloaded from releases.jfrog.io. You may need to add that to your list as well.\n\n## Jenkins Configuration as Code\n\nTo configure this plugin on Jenkins Configuration as Code, add the following sections to the jenkins.yaml:\n\n1. Configure connection details to the JFrog platform\n    ```yaml\n    unclassified:\n      jFrogPlatformBuilder:\n        jfrogInstances:\n          - serverId: \"acme\"\n            url: \"https://acme.jfrog.io\"\n            artifactoryUrl: \"https://acme.jfrog.io/artifactory\"\n            distributionUrl: \"https://acme.jfrog.io/distribution\"\n            xrayUrl: \"https://acme.jfrog.io/xray\"\n            credentialsConfig:\n              credentialsId: \"acme-secret-recipe\"\n    ```\n2. Add JFrog CLI tool using one of the following methods:\n\n* [Automatic installation from release.jfrog.io](#automatic-installation-from-releasejfrogio):\n    ```yaml\n    tool:\n      jfrog:\n        installations:\n        - name: \"jfrog-cli\"\n          properties:\n          - installSource:\n              installers:\n              - \"releasesInstaller\"\n    ```\n\n* [Automatic installation from Artifactory](#automatic-installation-from-artifactory):\n    ```yaml\n    tool:\n      jfrog:\n        installations:\n          - name: \"jfrog-cli\"\n            properties:\n              - installSource:\n                  installers:\n                    - artifactoryInstaller:\n                        repository: \"jfrog-cli-remote\"\n    ```\n\n* [Manual installation](#manual-installation):\n    ```yaml\n    tool:\n      jfrog:\n        installations:\n          - name: \"jfrog-cli\"\n            home: \"/path/to/jfrog/cli/dir/\"\n    ```\n\n## Examples\n\n\u003cdetails\u003e\n  \u003csummary\u003eUploading and downloading generic files\u003c/summary\u003e\n\n```groovy\npipeline {\n    agent any\n    tools {\n        jfrog 'jfrog-cli'\n    }\n    stages {\n        stage('Testing') {\n            steps {\n                // Show the installed version of JFrog CLI.\n                jf '-v'\n\n                // Show the configured JFrog Platform instances.\n                jf 'c show'\n\n                // Ping Artifactory.\n                jf 'rt ping'\n\n                // Create a file and upload it to a repository named 'my-repo' in Artifactory\n                sh 'touch test-file'\n                jf 'rt u test-file my-repo/'\n\n                // Publish the build-info to Artifactory.\n                jf 'rt bp'\n\n                // Download the test-file\n                jf 'rt dl my-repo/test-file'\n            }\n        }\n    }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eDocker\u003c/summary\u003e\n\n#### Preconditions\n\n1. Populate 'DOCKER_REG_URL' with the Artifactory Docker registry, for example - 'acme.jfrog.io'.\n2. Use an agent with a running Docker daemon.\n3. To build the Docker image, install the \"Docker Pipeline\" on Jenkins.\n\n```groovy\npipeline {\n    agent any\n    tools {\n        jfrog 'jfrog-cli'\n    }\n    environment {\n        DOCKER_IMAGE_NAME = \"$DOCKER_REG_URL/docker-local/hello-frog:1.0.0\"\n    }\n    stages {\n        stage('Clone') {\n            steps {\n                git branch: 'master', url: \"https://github.com/jfrog/project-examples.git\"\n            }\n        }\n\n        stage('Build Docker image') {\n            steps {\n                script {\n                    docker.build(\"$DOCKER_IMAGE_NAME\", 'docker-oci-examples/docker-example')\n                }\n            }\n        }\n\n        stage('Scan and push image') {\n            steps {\n                dir('docker-oci-examples/docker-example/') {\n                    // Scan Docker image for vulnerabilities\n                    jf 'docker scan $DOCKER_IMAGE_NAME'\n\n                    // Push image to Artifactory\n                    jf 'docker push $DOCKER_IMAGE_NAME'\n                }\n            }\n        }\n\n        stage('Publish build info') {\n            steps {\n                jf 'rt build-publish'\n            }\n        }\n    }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eMaven\u003c/summary\u003e\n\n```groovy\npipeline {\n    agent any\n    tools {\n        jfrog 'jfrog-cli'\n    }\n    stages {\n        stage('Clone') {\n            steps {\n                git branch: 'master', url: \"https://github.com/jfrog/project-examples.git\"\n            }\n        }\n\n        stage('Exec Maven commands') {\n            steps {\n                dir('maven-examples/maven-example') {\n                    // Configure Maven project's repositories\n                    jf 'mvn-config --repo-resolve-releases libs-release --repo-resolve-snapshots libs-snapshots --repo-deploy-releases libs-release-local --repo-deploy-snapshots libs-snapshot-local'\n\n                    // Install and publish project\n                    jf 'mvn clean install'\n                }\n            }\n        }\n\n        stage('Publish build info') {\n            steps {\n                jf 'rt build-publish'\n            }\n        }\n    }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eGradle\u003c/summary\u003e\n\n```groovy\npipeline {\n    agent any\n    tools {\n        jfrog 'jfrog-cli'\n    }\n    stages {\n        stage('Clone') {\n            steps {\n                git branch: 'master', url: \"https://github.com/jfrog/project-examples.git\"\n            }\n        }\n\n        stage('Exec Gradle commands') {\n            steps {\n                dir('gradle-examples/gradle-example-ci-server') {\n                    // Configure Gradle project's repositories\n                    jf 'gradle-config --repo-resolve libs-release --repo-deploy libs-release-local'\n\n                    // Install and publish project\n                    jf 'gradle clean artifactoryPublish'\n                }\n            }\n        }\n\n        stage('Publish build info') {\n            steps {\n                jf 'rt build-publish'\n            }\n        }\n    }\n}\n```\n\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003enpm\u003c/summary\u003e\n\n```groovy\npipeline {\n    agent any\n    tools {\n        jfrog 'jfrog-cli'\n    }\n    stages {\n        stage('Clone') {\n            steps {\n                git branch: 'master', url: \"https://github.com/jfrog/project-examples.git\"\n            }\n        }\n\n        stage('Exec npm commands') {\n            steps {\n                dir('npm-example') {\n                    // Configure npm project's repositories\n                    jf 'npm-config --repo-resolve npm-remote --repo-deploy npm-local'\n\n                    // Install dependencies\n                    jf 'npm install'\n\n                    // Pack and deploy the npm package\n                    jf 'npm publish'\n                }\n            }\n        }\n\n        stage('Publish build info') {\n            steps {\n                jf 'rt build-publish'\n            }\n        }\n    }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eGo\u003c/summary\u003e\n\n```groovy\npipeline {\n    agent any\n    tools {\n        jfrog 'jfrog-cli'\n    }\n    stages {\n        stage('Clone') {\n            steps {\n                git branch: 'master', url: \"https://github.com/jfrog/project-examples.git\"\n            }\n        }\n\n        stage('Exec Go commands') {\n            steps {\n                dir('golang-example/hello/') {\n                    // Configure Go project's repositories\n                    jf 'go-config --repo-resolve go-remote --repo-deploy go-local'\n\n                    // Build the project with go and resolve the project dependencies from Artifactory\n                    jf 'go build'\n\n                    // Publish version v1.0.0 of the package to the go-local repository in Artifactory\n                    jf 'go-publish v1.0.0'\n                }\n            }\n        }\n\n        stage('Publish build info') {\n            steps {\n                jf 'rt build-publish'\n            }\n        }\n    }\n}\n```\n\n\u003c/details\u003e\n\nThese examples demonstrate only a fraction of the capabilities of JFrog CLI. Please refer to\nthe [JFrog CLI documentation](https://www.jfrog.com/confluence/display/CLI/JFrog+CLI) for additional information.\n\n## Contributions\n\nWe welcome pull requests from the community. To help us improve this project, please read\nour [Contribution](./CONTRIBUTING.md#-guidelines) guide.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fjfrog-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenkinsci%2Fjfrog-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenkinsci%2Fjfrog-plugin/lists"}