Preparing the Docker Image
To control a CI/CD workflow, GitLab supports adding custom functionality to the workflow via containers. The container needs to be registered in the GitLab container registry for each project repository that wished to be invoked via a CI/CD workflow. iCR takes advantage of that to implement its integration into GitLab CI/CD via its supplied GitLab component which is a Docker image.
This Docker component MUST be registered from within the project repository for which a CI/CD workflow is desired. If you have multiple projects that wish to use iCR in a workflow, follow these steps for EACH repository. Since the CI/CD directory is included in the iCR product package and is created when the package is unzipped, these steps will assume access to the machine where the package was installed.
Included in the iCR package is a script named prep-container.sh
. This script is used to prepare the provided iCR GitLab component for use with GitLab CI/CD. To prepare the component for use with GitLab, enter the command below from the CI/CD directory where the package was unzipped as this is where the Docker image is located:
./prep-container gitlab <username> <authentication-token> <repository-name> [<enterprise-URL>]
Where <username>
is the name of the user who owns the repository to be analyzed and <repository-name>
is the name of the repository. Note that the <username>
and <repository-name>
MUST be lowercase to satisfy the registry naming conventions. If the user is planning on pulling the source code from a GitLab Enterprise server, then the URL of the Enterprise server must be specified using <enterprise-URL>
.
Staying with the examples used in the User Guide for Private Platforms, and assuming a cloud-based VCS, the command would look like:
./prep-container gitlab or-testuser baritone
This command causes the GitLab component named icr-gitlab
, to be inserted into Docker with the name that is required by the GitLab registry. The output looks like:
The Docker image name will look like:
Now we can register the container with the GitLab registry.
Last updated