Introduction

ARTIFACTORY: Docker build + Gitlab integration with Artifactory and scan with JFrog Xray as part of a JFrog project

AuthorFullName__c
Swarnendu Kayal
articleNumber
000005368
ft:sourceType
Salesforce
FirstPublishedDate
2022-08-10T13:53:41Z
lastModifiedDate
2022-08-10
VersionNumber
5
GitLab can be used as a CI/CD tool along with many other features that it has. In order to integrate the GitLab with JFrog Artifactory, there is no such out of the box plugin available. However, we can integrate it using our very own CLI tool called JFrog CLI. We can build with multiple package types using JFrog CLI. More details on JFrog CLI are mentioned in this confluence page.

In this KB article, we will discuss a docker build. The docker build has four steps –
  1. Create a GitLab project and upload all the required files to the GitLab repository.
  2. Pull a base image from Docker Hub.
  3. Build a docker image using the image that we have pulled. The step # 2 and # 3 will be done as part of a Dockerfile.
  4. Do a scan of the image before even pushing to the Artifactory. You can find more details about on-demand scanning here in this page. Please note that it will refer to the watch and policy and the policy has a rule to fail the build if the image contains any vulnerability.
  5. Push the image to the Artifactory and publish the build information.
  6. Scan that build using the JFrog Xray.