Skip to content

Commit 89b12c4

Browse files
authored
Onboard CI image publication off the public-images job-token trigger
2 parents d0e9e1d + 4173a7c commit 89b12c4

2 files changed

Lines changed: 29 additions & 13 deletions

File tree

.gitlab/generate-ci-images.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
* This script prints a literal preamble (stages, job templates), then loops
1313
* over the parsed compose services to emit, per Linux OS, one build matrix job
1414
* over PHP versions (bake builds and pushes the multi-arch image, then ddsign
15-
* signs it) plus a manual publish matrix job that mirrors the tags to Docker
16-
* Hub. Windows is emitted the same way but single-arch (no manifest) with its
15+
* signs it) plus a manual publish matrix job that mirrors the tags to the public
16+
* registries. Windows is emitted the same way but single-arch (no manifest) with its
1717
* own build runner/script; its images are signed by a separate Linux job
1818
* (ddsign has no Windows binary), see .image_sign.
1919
*/
@@ -126,24 +126,36 @@ function parse_compose(string $path, array $env): array
126126
# pod uses cluster defaults. MAKE_JOBS sets the builder's compile parallelism.
127127
MAKE_JOBS: "8"
128128

129+
# Mirrors an existing registry.ddbuild.io tag to the public registries via
130+
# artifact-gateway. tags: is required — this replaced a trigger/bridge job, which
131+
# needed no runner, and neither the parent pipeline nor this generated child sets
132+
# a `default:`.
129133
.image_publish:
130134
stage: ci-publish
131135
rules:
132136
- when: manual
133137
allow_failure: true
134138
# No deps: a publish just mirrors whatever already exists in
135-
# registry.ddbuild.io to Docker Hub, so it can run without (re)building.
139+
# registry.ddbuild.io, so it can run without (re)building.
136140
needs: []
137-
trigger:
138-
project: DataDog/public-images
139-
branch: main
140-
strategy: depend
141+
image: registry.ddbuild.io/agent-delivery/dd-pkg:v0.9.3
142+
tags: ["arch:arm64"]
141143
# $TAG is supplied per matrix entry by the generated publish jobs.
142144
variables:
143-
IMG_REGISTRIES: "dockerhub"
144-
IMG_SIGNING: false
145+
IMG_REGISTRIES: "public"
146+
IMG_SIGNING: "false"
145147
IMG_SOURCES: "${CI_REGISTRY_IMAGE}:${TAG}"
146148
IMG_DESTINATIONS: "dd-trace-ci:${TAG}"
149+
PUBLIC_IMAGES_PUBLISH_TIMEOUT: "1800"
150+
script:
151+
- |
152+
set -euo pipefail
153+
dd-pkg version
154+
args=(publish-image --timeout "${PUBLIC_IMAGES_PUBLISH_TIMEOUT}" --poll-interval 30 --signing="${IMG_SIGNING}")
155+
if [[ -n "${IMG_REGISTRIES:-}" ]]; then args+=(--registries "${IMG_REGISTRIES}"); fi
156+
if [[ -n "${IMG_SOURCES:-}" ]]; then args+=(--sources "${IMG_SOURCES}"); fi
157+
if [[ -n "${IMG_DESTINATIONS:-}" ]]; then args+=(--destinations "${IMG_DESTINATIONS}"); fi
158+
dd-pkg "${args[@]}"
147159

148160
# Signs an already-pushed tag in registry.ddbuild.io. Used for the Windows
149161
# images: they're built without buildx (see .windows_image_build), so unlike

dockerfiles/ci/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ repo.
3838
(ddsign only ships for Linux/Mac), so they're signed by a separate `Windows
3939
sign` job that runs on Linux and looks up the pushed tag's digest with
4040
`docker buildx imagetools inspect` instead.
41-
* **Publish:** a `trigger` to the `DataDog/public-images` service mirrors the
42-
internal image to Docker Hub. It has no dependency on the build (see below).
41+
* **Publish:** a `dd-pkg publish-image` call against artifact-gateway mirrors the
42+
internal image to the public registries. It has no dependency on the build (see
43+
below).
4344

4445
## Building via GitLab-CI
4546

@@ -55,8 +56,11 @@ pipeline. Per OS it has two kinds of jobs:
5556
`ddsign`. Run the version(s) you need. Authentication to the internal
5657
registry is automatic via the runner's native credentials.
5758
2. **`<OS> publish`** (manual, a matrix with one instance per tag) — mirrors
58-
`…:<tag>` from the internal registry to the public Docker Hub
59-
(`datadog/dd-trace-ci`) via a downstream `public-images` pipeline.
59+
`…:<tag>` from the internal registry to the `dd-trace-ci` repository on the
60+
public registries, by calling `dd-pkg publish-image` against
61+
artifact-gateway. A `public-images` pipeline still performs the copy, but you
62+
no longer trigger or watch it: `dd-pkg` polls it and this job succeeds or
63+
fails with it, so start troubleshooting from the job log.
6064

6165
Windows has an extra manual job, **`Windows sign`** (a matrix with one
6266
instance per tag), since `Windows build` can't sign its own images (see

0 commit comments

Comments
 (0)