Skip to main content

Private Certificate Authority

To trust a private HTTPS service, create a GitLab File variable named CI_CA_BUNDLE_PATH containing your PEM certificates. GitLab gives each job the file path, not the PEM text. The common component uses this name by default.

For a different File variable, give ca-bundle-variable its name, without $:

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
inputs:
ca-bundle-variable: COMPANY_CA_PEM

For a file already in the job, set ca-bundle-path to its readable absolute path. A custom variable name takes precedence. If the selected variable is unset or empty, trust stays unchanged without a warning.

Environment variables by stage​

Stage and scopeVariable or settingWhat it does
Bootstrap: select fileCI_TOOLS_CA_BUNDLE_VARIABLE → CI_CA_BUNDLE_PATHThe bootloader reads the named variable and exports its path for the job.
Bootstrap: download onlycurl --cacert; Git GIT_SSL_CAINFOBoth use the supplied PEM. The Git override lasts only for the clone.
Job: native clients, rootNo CA variable setAdds the PEM to system trust if a supported Debian or Red Hat updater exists.
Job: native clients, non-rootSSL_CERT_FILE, CURL_CA_BUNDLE, GIT_SSL_CAINFOExported to a file containing system roots + supplied PEM. The shell variable CI_TOOLS_JOB_CA_BUNDLE holds that path.
Job and each build RUN: Node.jsNODE_EXTRA_CA_CERTSAdds the supplied PEM to Node’s built-in roots, for either user.
Job and each build RUN: JavaJAVA_TOOL_OPTIONSIf $JAVA_HOME/bin/keytool is executable, appends options selecting a temporary trust store with only the supplied roots.
Buildah / Podman: registry pull or pushJob trust settingsRegistry clients use job-side trust, regardless of the Containerfile’s USER.
Buildah: each Containerfile RUNCI_CA_BUNDLE_PATH (build argument)Points to /run/ci-tools-ca/ca-bundle.crt from the original PEM, not the merged job bundle. Existing native stores temporarily expose only the supplied roots.
Final image: runtimeNone addedThe image keeps its own trust settings. Build mounts and temporary stores do not persist.

Include the necessary public roots in your PEM when bootstrap, Java, or a native client in a build step also needs public HTTPS. See build-time CA trust for mount details.

Validation: Job initialization checks PEM structure, then tries OpenSSL, Python 3 (ssl), Node.js (crypto.X509Certificate), or Java keytool, in that order. A missing parser allows fallback; a rejected certificate fails the job. Without a parser, valid PEM structure is enough to continue with a warning. Buildah preparation requires the OpenSSL command.

Run Node.js or Java directly in a job​

In a job that already loads CI Tools, run your usual command (for example, npm ci or ./mvnw verify). No Buildah step or separate CA export is needed. For Java, set JAVA_HOME before initialization so CI Tools can find bin/keytool.

For a custom job, load the bootloader in the same shell before starting Node.js or Java. If a minimal image cannot fetch CI Tools but already has the scripts locally, set CI_CA_BUNDLE_PATH to the PEM path and source scripts/library.sh directly. Only the bootloader resolves custom variable names.