Loading
docs(specs): specify CI job image pull credentials in monolith/S16
Summary
- Problem: a CI job cannot use an Artifact Registry image in
image:orservices:withoutDOCKER_AUTH_CONFIG. The runner pulls those images before the job script runs, and the job payload carries no credential for the Artifact Registry host, so the pull fails with401. - Impact: every CI user of Artifact Registry container repositories. The workaround needs a stored token that expires after at most 12 hours. The tracking item calls this the top container adoption blocker.
- Change: this spec, monolith/S16, defines a third job payload credential next to the GitLab container registry and dependency proxy entries:
type: "registry"for the Artifact Registry host, carrying an Artifact Registry token issued for the job's user that expires with the job, at most 12 hours after its issue. Unmodified runners apply it to the pre-job pull. Artifact Registry needs no change. - Downsides: the token acts with the job user's full permissions and cannot be revoked before it expires, which can be up to 12 hours for a long job. Kubernetes runners with
use_service_account_image_pull_secretsignore it. A refused pull still shows up asrunner_system_failure, or asrunner_configuration_errorfrom Runner 19.2, not as an authentication error. Jobs whose user is not a member of the project's organization get no credential.
The design was reproduced and prototyped against a GDK, a local Artifact Registry and GitLab Runner 18.11.3; the evidence is in gitlab-org/gitlab#630573 (comment 4042830848) and the replies under it.
Checklist
- Gaps: Kubernetes executors with
use_service_account_image_pull_secrets, jobs whose user is not an organization member, images in another organization's namespace, and remote runners against a SaaS Artifact Registry (gitlab-org/gitlab#599087) all keepDOCKER_AUTH_CONFIG. A clear authentication error for a refused pull is a runner and Verify change (gitlab-org/gitlab#634871). Telling a CI pull token from a user token needs a dedicated audience (#1691). Each of these is either existing runner behavior or needs another team's change, and none blocks the common case. - Least sure: that ADR-020 covers GitLab issuing the token itself while it builds the job payload. ADR-020 describes a client-side exchange; here the runner receives the token from its GitLab instance and presents it, Artifact Registry never exchanges anything, and ADR-014 already lets Rails acquire an Artifact Registry token server-side for a user. A reviewer reading ADR-020 as requiring a call to the token exchange endpoint would change my mind. Second: that runners older than 18.11.3 apply a
type: "registry"credential for another host; that is read from the runner code and tested only on 18.11.3. - Compatibility: nothing breaks. The credential is added behind a feature flag. A job that already sets
DOCKER_AUTH_CONFIGfor the host keeps using it, because the runner prefers it. Older runners ignore unknown credential types, and this one keeps the known type. - Agreement: Verify, which owns the job payload code (
/lib/**/ci/,cicd-verifymaintainers). Product, for the two acceptance criteria this spec does not meet (clear auth error, Kubernetes exception). AppSec, which signs off token lifetimes under ADR-020: it accepts this one, the job's timeout capped at 12 hours, as an interim with two tracked follow-ups (#1691, #1771); its approval on this MR is pending. Verify and Product have not agreed yet. The ADR-020 architects, for issuing the token in process rather than through the token exchange endpoint: the amendment gitlab-com/content-sites/handbook!21673 (merged) records it for this spec and the Artifact Registry UI, and is in review. - Simplicity: rejected having the runner exchange the job token before the pull, which needs a runner release and leaves older runners failing, and having Artifact Registry accept
CI_JOB_TOKENdirectly, which ADR-020 rules out because Artifact Registry would have to call back to GitLab. Also rejected a dedicated audience in this iteration: it needs an ADR-020 amendment and an IAM library change and changes nothing a client sees until Artifact Registry acts on it.
Related to gitlab-org/gitlab#630573
Edited by Daniel Prause