This Bitbucket Pipe downloads, installs and configures JFrog CLI, so that it can be used as part of your YAML configuration.
- Bitbucket Pipelines
- JFrog CLI version 1
Configuring JFrog CLI on Local Machine:
Before you can configure JFrog Bitbucket Pipe, you would need to configure JFrog CLI on your local machine first. In this example, we are using JFrog CLI version 1.47.0.
To configure your JFrog CLI to Artifactory, please run #jfrog config add. A prompt will appear asking for your Artifactory URL and credentials.
Once done, please run to #jfrog rt ping to verify that the connection was made successfully.
Export JFrog CLI configuration:
Once JFrog CLI has been configured successfully, you would need to export its configuration in order for you to use it in Bitbucket. To export, please run #jfrog config export <Server-ID>
Copy the output of the above command and save it in a text file.
Importing Configuration to Bitbucket:
To import JFrog CLI configuration to Bitbucket, you will need to create variables. These variables can either be workspace variables or repository variables. In this walkthrough, we will create a workspace variable that any project can access.
On the Repositories page, click on Settings to the left of the page.
Once you are in the Settings Page, create a variable called JF_ARTIFACTORY_<Desired_name> and paste the key from the export command as the value. Click add to save the variable.
JFROG_CLI_VERSION = Specify version of JFrog CLI for Bitbucket to download. If not specify, Bitbucket will use JFrog CLI version 1.37.1
Adding JFrog CLI Pipe to Bitbucket YAML:
Once you have the necessary variables added, you will need to add the below tasks to our Bitbucket Pipelines YAML file.
- pipe: jfrog/jfrog-setup-cli:1.0.0
- source ./jfrog-setup-cli.sh
Once added, you can perform a test run of our Pipelines to make sure there is no issue.
To verify that Bitbucket was able to successfully connect to JFrog Artifactory, you can add a task to perform a ping to Artifactory.
jfrog rt ping
You should see an OK response from Artifactory if Bitbucket was able to successfully connect to Artifactory.