Integrating JFrog Artifactory into your GitLab CI workflow makes JFrog’s ‘Release Fast or Die’ mantra, a living reality.
This blog post describes how to integrate GitLab CI with Artifactory not only to resolve and deploy binaries but also to benefit from Artifactory’s Build Integration feature.
Publish and manage your packages
GitLab CI supports creating multiple builds and assesses how each commit passes your tests and affects your products. During the build process, a mass of binaries is generated, that if not managed correctly on a large scale, can lead to binary havoc. To overcome this, Artifactory is seamlessly integrated into your build process in order to publish and manage these binaries. Via JFrog CLI, GitLab CI fetches, caches, and publishes your dependencies, created packages, and build information to Artifactory.
Artifactory’s Build Integration automatically links each generated package to its relevant build, dependencies, information, and collects a new set of metadata that you might not have benefited from until now. Once Artifactory is integrated with GitLab CI, you can store and view the information such as:
- Build information and published modules
- Used Dependencies
- Environment Variables
- License Summary
- Links to your issue-tracker
- Diffs between builds
The data is stored in the Artifactory database allows you to retrieve it also using the Artifactory Query Language.
Embed Artifactory into your GitLab CI workflow
The following step-by-step example demonstrates how to embed Artifactory into your GitLab CI workflow. In this example, we’ll use Maven. This and additional package type examples are available in GitHub.
- Create a new project in GitLab.
- Clone this Maven sample project into your GitLab repository.
- Configure the following Artifactory credentials in your Maven project, under CI/CD Settings > Secret variables:
MAVEN_REPO_KEY: Name of the target repository in Artifactory
- Commit the following .gitlab-ci.yml configuration file to the root directory of your project. This file is a customized template that can be edited according to your needs.
An instant build is automatically triggered after you commit the configuration file and Artifactory is populated with your Maven packages and cached dependencies.
- Navigate to the job in the GitLab CI UI to view the build process and logs.
- Log into Artifactory and navigate to the
Artifact Repository Browser to view your published artifacts in Artifactory.
- Navigate to the Build Browser to view the build information.
That’s it! You’re done.