Chapter 2. Configuring GitLab CI for external integration by using the CLI
Prerequisites
Before you configure GitLab CI, ensure you have the following:
- Admin access to your GitLab repository and CI/CD settings.
- Container registry credentials for pulling container images from Quay, JFrog Artifactory, or Sonatype Nexus Repository.
Authentication details for specific GitLab CI tasks:
For ACS security tasks:
- ROX Central server endpoint
- ROX API token
For SBOM and artifact signing tasks:
- Cosign signing key password, private key and public key
- Trustification API and issuer URL, client ID, client secret, and supported CycloneDX version
NoteThe credentials and other details are already Base64-encoded, so you do not need to encode them again. You can find these credentials in your
private.envfile, which you created during RHADS - SSC installation.
Procedure
Create a project with two files in your preferred text editor, such as Visual Studio Code:
-
env_vars.sh -
glab-set-vars
-
Update the
env_vars.shfile with the following environment variables:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the
glab-set-varsfile with the following information:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteBy default, the
setVarsfunction creates a variable as a secret, and this variable’s value won’t be displayed in the UI and logs. To create an unmasked variable, addfalseat the end of a line where you set it. For example:setVars COSIGN_PUBLIC_KEY $COSIGN_PUBLIC_KEY false
$ setVars COSIGN_PUBLIC_KEY $COSIGN_PUBLIC_KEY falseCopy to Clipboard Copied! Toggle word wrap Toggle overflow Load the environment variables into your current shell session:
source env_vars.sh
$ source env_vars.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow Make the
glab-set-varsscript executable, and run it with your repository name to set the variables in your GitLab repository.chmod +x glab-set-vars
$ chmod +x glab-set-varsCopy to Clipboard Copied! Toggle word wrap Toggle overflow ./glab-set-vars your_repository_name
./glab-set-vars your_repository_nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Rerun the last pipeline run to verify the secrets are applied correctly. Alternatively, switch to you application’s source repository in GitLab, make a minor change, and commit it to trigger a new pipeline run.