DEV Community

Batel Zohar for JFrog

Posted on • Originally published at circleci.com

CircleCI integration with container registries

CircleCI is a cloud-based continuous integration and delivery platform, It’s free for open-source repositories and supports most languages. From version 2.1, CircleCI supports orbs, that are shareable packages of configuration elements, including jobs, commands, and executors. Therefore we don’t need to reinvent the wheel as we can easily use the artifactory-orb which contains the JFrog CLI to store our build artifacts for future distribution in our Docker Container Registry. In this blog, I will show you how to use CircleCI by using a private JFrog Container Registry to store your builds, artifacts, and build information.

Let’s take a closer look at how this actually works. The following example describes how to easily configure CircleCI to push Docker builds as artifacts to JFrog container registry using orbs.
Step 1: Clone the sample repository
Create a repository in GitHub and clone this sample GitHub project into your git repository.
Step 2: Create the CircleCI configuration files
In this example, we use the artifactory-orbs to download the JFrog CLI to perform thee following under the hood:

Description: Install the JFrog CLI Steps: run: command: | echo "Checking for existence of CLI" set +e jfrog -v if [ $? -gt 0 ]; then echo "Not found, installing latest" curl -fL https://getcli.jfrog.io | sh chmod a+x jfrog && sudo mv jfrog /usr/local/bin else echo "CLI exists, skipping install" fi name: Install JFrog CLI

This is the full config file.:

orbs: artifactory: circleci/artifactory@1.0.0 version: 2.1 workflows: simple-docker-example: jobs: - artifactory/docker-publish: docker-registry: batelt-docker.jfrog.io docker-tag: 'batelt-docker.jfrog.io/hello-world:1.0-${CIRCLE_BUILD_NUM}' name: Docker Publish Simple repository: docker-local

Here also in the background, we are using the Building Docker Imagescommands via the JFrog CLI.
Step 3: Enable Pipelines
To orbs, we have to enable Pipelines via the UI under Project Settings -> Advanced Settings as follows.
Enable Pipelines
Step 4: Configure the environment variables
Enable your project build in CircleCI by adding the following variables to your build settings:
ARTIFACTORY_URL
ARTIFACTORY_USERNAME
ARTIFACTORY_API_KEY
Configure the environment variables
Step 5: View your build in the JFrog Container Registry
You can now view build in details in the JFrog Container RegistryBuild Browser. Click any build to drill down and view all the build info that the JFrog Container Registry captures.
View your build

Great! That’s it. You have successfully completed integrating the JFrog Container Registry in CircelCI done.

Top comments (0)