Skip to content

Commit 4e5fd29

Browse files
ci: pass internal registry into centos/alpine builds; generate Windows jobs
- centos/alpine compose now pass CI_REGISTRY_IMAGE as a build arg (anchor on base, merged into php services) so PHP images build FROM the freshly-built internal base instead of the Docker Hub fallback (matches bookworm BUILD_BASE). - Windows build + publish jobs are generated from docker-compose.yml; the build matrix now includes the windows-base-* services so they exist in the internal registry before publish. Linux + Windows publish share .image_publish.
1 parent c80c24d commit 4e5fd29

3 files changed

Lines changed: 63 additions & 61 deletions

File tree

.gitlab/generate-ci-images.php

Lines changed: 33 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
*
1010
* The compose service name is the `docker buildx bake` target and the build
1111
* matrix value; the `image:` tag (with env vars resolved) is the published tag.
12-
* This script prints a literal preamble (stages, job templates, and the
13-
* single-arch Windows jobs), then loops over the parsed compose services to
14-
* emit, per Linux OS, one build matrix job over PHP versions (bake builds and
15-
* pushes the multi-arch image) plus a manual publish matrix job that mirrors
16-
* the tags to Docker Hub.
12+
* This script prints a literal preamble (stages, job templates), then loops
13+
* over the parsed compose services to emit, per Linux OS, one build matrix job
14+
* over PHP versions (bake builds and pushes the multi-arch image) plus a manual
15+
* publish matrix job that mirrors the tags to Docker Hub. Windows is emitted the
16+
* same way but single-arch (no manifest) with its own build runner/script.
1717
*/
1818

1919
$root = dirname(__DIR__);
@@ -84,11 +84,19 @@ function parse_compose(string $path, array $env): array
8484
}
8585
$osList[] = ["name" => $os, "dir" => $dir, "services" => $services];
8686
}
87+
88+
// Windows is single-arch (no multi-arch manifest) and uses a different build
89+
// runner/script, so it is emitted separately from the Linux loop below. It has
90+
// no .env, so tags resolve with an empty env map.
91+
$winServices = parse_compose("$root/dockerfiles/ci/windows/docker-compose.yml", []);
92+
if (!$winServices) {
93+
fwrite(STDERR, "WARNING: no services parsed for Windows\n");
94+
}
8795
?>
8896
# CI image build + publish child pipeline, generated by
8997
# .gitlab/generate-ci-images.php from the docker-compose.yml + .env files.
90-
# Edit the generator, never this generated file. The Windows jobs are
91-
# hand-written in the generator (single-arch, no multi-arch manifest).
98+
# Edit the generator, never this generated file. Windows is generated too
99+
# (single-arch, no multi-arch manifest, different build runner/script).
92100

93101
stages:
94102
- ci-build
@@ -111,7 +119,7 @@ function parse_compose(string $path, array $env): array
111119
# pod uses cluster defaults. MAKE_JOBS sets the builder's compile parallelism.
112120
MAKE_JOBS: "8"
113121

114-
.linux_publish:
122+
.image_publish:
115123
stage: ci-publish
116124
rules:
117125
- when: manual
@@ -206,64 +214,28 @@ function parse_compose(string $path, array $env): array
206214
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
207215
}
208216

209-
"Windows 1: Tool Images":
210-
extends: .windows_image_build
211-
parallel:
212-
matrix:
213-
- WINDOWS_IMAGE_TARGETS:
214-
- "vc15"
215-
- "vs16"
216-
- "vs17"
217-
218-
"Windows 2: PHP Images":
217+
<?php /*
218+
Windows: single matrix over every compose service (base tools + tools + php).
219+
No needs/deps - like the Linux base/php builds, you manually run the base
220+
matrix entries before the dependent ones.
221+
*/ ?>
222+
Windows build:
219223
extends: .windows_image_build
220224
parallel:
221225
matrix:
222226
- WINDOWS_IMAGE_TARGETS:
223-
- "php-8.5"
224-
- "php-8.4"
225-
- "php-8.3"
226-
- "php-8.2"
227-
- "php-8.1"
228-
- "php-8.0"
229-
- "php-7.4"
230-
- "php-7.3"
231-
- "php-7.2"
227+
<?php foreach (array_keys($winServices) as $svc): ?>
228+
- "<?= $svc ?>"
229+
<?php endforeach; ?>
232230

233-
Publish Windows:
234-
stage: ci-publish
235-
rules:
236-
- when: manual
237-
allow_failure: true
238-
needs:
239-
- job: "Windows 1: Tool Images"
240-
- job: "Windows 2: PHP Images"
241-
trigger:
242-
project: DataDog/public-images
243-
branch: main
231+
Windows publish:
232+
extends: .image_publish
244233
parallel:
245234
matrix:
246-
- TAG_NAME:
247-
- "windows-base-vc15"
248-
- "windows-base-vs16"
249-
- "windows-base-vs17"
250-
- "windows-vc15"
251-
- "windows-vs16"
252-
- "windows-vs17"
253-
- "php-8.5_windows"
254-
- "php-8.4_windows"
255-
- "php-8.3_windows"
256-
- "php-8.2_windows"
257-
- "php-8.1_windows"
258-
- "php-8.0_windows"
259-
- "php-7.4_windows"
260-
- "php-7.3_windows"
261-
- "php-7.2_windows"
262-
variables:
263-
IMG_SOURCES: "registry.ddbuild.io/ci/dd-trace-php/dd-trace-ci:${TAG_NAME}"
264-
IMG_DESTINATIONS: "dd-trace-ci:${TAG_NAME}"
265-
IMG_REGISTRIES: "dockerhub"
266-
IMG_SIGNING: false
235+
- TAG:
236+
<?php foreach ($winServices as $tag): ?>
237+
- "<?= $tag ?>"
238+
<?php endforeach; ?>
267239
<?php foreach ($osList as ['name' => $os, 'dir' => $dir, 'services' => $services]): ?>
268240
<?php /*
269241
One build job per PHP version. buildx bake reads the x-bake platforms from
@@ -285,11 +257,11 @@ function parse_compose(string $path, array $env): array
285257
- docker buildx bake --no-cache --pull --push "${PHP_VERSION}"
286258
<?php /*
287259
Mirror to Docker Hub: one matrix job per OS, independent (needs: [] via
288-
.linux_publish) so it can sync existing images without rebuilding.
260+
.image_publish) so it can sync existing images without rebuilding.
289261
*/ ?>
290262

291263
<?= $os ?> publish:
292-
extends: .linux_publish
264+
extends: .image_publish
293265
parallel:
294266
matrix:
295267
- TAG:

dockerfiles/ci/alpine_compile_extension/docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ services:
1111
platforms:
1212
- linux/arm64
1313
- linux/amd64
14+
args: &build-base
15+
# Build php images FROM the (possibly freshly built) internal base,
16+
# not the Docker Hub fallback baked into the Dockerfile ARG default.
17+
CI_REGISTRY_IMAGE: ${CI_REGISTRY_IMAGE:-datadog/dd-trace-ci}
1418
volumes:
1519
- ../../:/app
1620

@@ -20,6 +24,7 @@ services:
2024
context: .
2125
x-bake: *bake
2226
args:
27+
<<: *build-base
2328
phpVersion: 7.0.33
2429
phpSha256Hash: d71a6ecb6b13dc53fed7532a7f8f949c4044806f067502f8fb6f9facbb40452a
2530
phpApi: 20151012
@@ -32,6 +37,7 @@ services:
3237
context: .
3338
x-bake: *bake
3439
args:
40+
<<: *build-base
3541
phpVersion: 7.1.33
3642
phpSha256Hash: 0055f368ffefe51d5a4483755bd17475e88e74302c08b727952831c5b2682ea2
3743
phpApi: 20160303
@@ -44,6 +50,7 @@ services:
4450
context: .
4551
x-bake: *bake
4652
args:
53+
<<: *build-base
4754
phpVersion: 7.2.34
4855
phpSha256Hash: 8b2777c741e83f188d3ca6d8e98ece7264acafee86787298fae57e05d0dddc78
4956
phpApi: 20170718
@@ -56,6 +63,7 @@ services:
5663
context: .
5764
x-bake: *bake
5865
args:
66+
<<: *build-base
5967
phpVersion: 7.3.33
6068
phpSha256Hash: 9a369c32c6f52036b0a890f290327f148a1904ee66aa56e2c9a7546da6525ec8
6169
phpApi: 20180731
@@ -68,6 +76,7 @@ services:
6876
context: .
6977
x-bake: *bake
7078
args:
79+
<<: *build-base
7180
phpVersion: 7.4.33
7281
phpSha256Hash: 5a2337996f07c8a097e03d46263b5c98d2c8e355227756351421003bea8f463e
7382
phpApi: 20190902
@@ -80,6 +89,7 @@ services:
8089
context: .
8190
x-bake: *bake
8291
args:
92+
<<: *build-base
8393
phpVersion: 8.0.30
8494
phpSha256Hash: 449d2048fcb20a314d8c218097c6d1047a9f1c5bb72aa54d5d3eba0a27a4c80c
8595
phpApi: 20200930
@@ -92,6 +102,7 @@ services:
92102
context: .
93103
x-bake: *bake
94104
args:
105+
<<: *build-base
95106
phpVersion: 8.1.31
96107
phpSha256Hash: 618923b407c4575bfee085f00c4aaa16a5cc86d4b1eb893c0f352d61541bbfb1
97108
phpApi: 20210902
@@ -104,6 +115,7 @@ services:
104115
context: .
105116
x-bake: *bake
106117
args:
118+
<<: *build-base
107119
phpVersion: 8.2.31
108120
phpSha256Hash: 083c2f61cc5f527eb293c4c468a91af46a9678785957e023b2796a9db290d870
109121
phpApi: 20220829
@@ -116,6 +128,7 @@ services:
116128
context: .
117129
x-bake: *bake
118130
args:
131+
<<: *build-base
119132
phpVersion: 8.3.31
120133
phpSha256Hash: 4e7baaf0a690e954a20e7ced3dd633ce8cb8094e2b6b612a55e703ecbbdcbf4f
121134
phpApi: 20230831
@@ -128,6 +141,7 @@ services:
128141
context: .
129142
x-bake: *bake
130143
args:
144+
<<: *build-base
131145
phpVersion: 8.4.22
132146
phpSha256Hash: a012c2c9724baf214a70b41b40a7e130906b8855e54268afa5bc4ae17bc9d823
133147
phpApi: 20240924
@@ -140,6 +154,7 @@ services:
140154
context: .
141155
x-bake: *bake
142156
args:
157+
<<: *build-base
143158
phpVersion: 8.5.7
144159
phpSha256Hash: "e5eba93fd6dd3241d0e61e932eb99a3783b40568553fb0e511b660ecd863a049"
145160
phpApi: 20250925

dockerfiles/ci/centos/7/docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ services:
1010
platforms:
1111
- linux/arm64
1212
- linux/amd64
13+
args: &build-base
14+
# Build php images FROM the (possibly freshly built) internal base,
15+
# not the Docker Hub fallback baked into the Dockerfile ARG default.
16+
CI_REGISTRY_IMAGE: ${CI_REGISTRY_IMAGE:-datadog/dd-trace-ci}
1317

1418
php-7.0:
1519
build:
1620
context: .
1721
dockerfile: php.Dockerfile
1822
x-bake: *bake
1923
args:
24+
<<: *build-base
2025
phpVersion: "7.0"
2126
phpTarGzUrl: https://www.php.net/distributions/php-7.0.33.tar.gz
2227
phpSha256Hash: d71a6ecb6b13dc53fed7532a7f8f949c4044806f067502f8fb6f9facbb40452a
@@ -28,6 +33,7 @@ services:
2833
dockerfile: php.Dockerfile
2934
x-bake: *bake
3035
args:
36+
<<: *build-base
3137
phpVersion: "7.1"
3238
phpTarGzUrl: https://www.php.net/distributions/php-7.1.33.tar.gz
3339
phpSha256Hash: 0055f368ffefe51d5a4483755bd17475e88e74302c08b727952831c5b2682ea2
@@ -39,6 +45,7 @@ services:
3945
dockerfile: php.Dockerfile
4046
x-bake: *bake
4147
args:
48+
<<: *build-base
4249
phpVersion: "7.2"
4350
phpTarGzUrl: https://www.php.net/distributions/php-7.2.34.tar.gz
4451
phpSha256Hash: 8b2777c741e83f188d3ca6d8e98ece7264acafee86787298fae57e05d0dddc78
@@ -50,6 +57,7 @@ services:
5057
dockerfile: php.Dockerfile
5158
x-bake: *bake
5259
args:
60+
<<: *build-base
5361
phpVersion: "7.3"
5462
phpTarGzUrl: https://www.php.net/distributions/php-7.3.33.tar.gz
5563
phpSha256Hash: 9a369c32c6f52036b0a890f290327f148a1904ee66aa56e2c9a7546da6525ec8
@@ -61,6 +69,7 @@ services:
6169
dockerfile: php.Dockerfile
6270
x-bake: *bake
6371
args:
72+
<<: *build-base
6473
phpVersion: "7.4"
6574
phpTarGzUrl: https://www.php.net/distributions/php-7.4.33.tar.gz
6675
phpSha256Hash: 5a2337996f07c8a097e03d46263b5c98d2c8e355227756351421003bea8f463e
@@ -72,6 +81,7 @@ services:
7281
dockerfile: php.Dockerfile
7382
x-bake: *bake
7483
args:
84+
<<: *build-base
7585
phpVersion: "8.0"
7686
phpTarGzUrl: https://www.php.net/distributions/php-8.0.30.tar.gz
7787
phpSha256Hash: 449d2048fcb20a314d8c218097c6d1047a9f1c5bb72aa54d5d3eba0a27a4c80c
@@ -83,6 +93,7 @@ services:
8393
dockerfile: php.Dockerfile
8494
x-bake: *bake
8595
args:
96+
<<: *build-base
8697
phpVersion: "8.1"
8798
phpTarGzUrl: https://www.php.net/distributions/php-8.1.32.tar.gz
8899
phpSha256Hash: "4846836d1de27dbd28e89180f073531087029a77e98e8e019b7b2eddbdb1baff"
@@ -94,6 +105,7 @@ services:
94105
dockerfile: php.Dockerfile
95106
x-bake: *bake
96107
args:
108+
<<: *build-base
97109
phpVersion: "8.2"
98110
phpTarGzUrl: https://www.php.net/distributions/php-8.2.31.tar.gz
99111
phpSha256Hash: "083c2f61cc5f527eb293c4c468a91af46a9678785957e023b2796a9db290d870"
@@ -105,6 +117,7 @@ services:
105117
dockerfile: php.Dockerfile
106118
x-bake: *bake
107119
args:
120+
<<: *build-base
108121
phpVersion: "8.3"
109122
phpTarGzUrl: https://www.php.net/distributions/php-8.3.31.tar.gz
110123
phpSha256Hash: "4e7baaf0a690e954a20e7ced3dd633ce8cb8094e2b6b612a55e703ecbbdcbf4f"
@@ -116,6 +129,7 @@ services:
116129
dockerfile: php.Dockerfile
117130
x-bake: *bake
118131
args:
132+
<<: *build-base
119133
phpVersion: "8.4"
120134
phpTarGzUrl: https://www.php.net/distributions/php-8.4.22.tar.gz
121135
phpSha256Hash: "a012c2c9724baf214a70b41b40a7e130906b8855e54268afa5bc4ae17bc9d823"
@@ -127,6 +141,7 @@ services:
127141
dockerfile: php.Dockerfile
128142
x-bake: *bake
129143
args:
144+
<<: *build-base
130145
phpVersion: "8.5"
131146
phpTarGzUrl: https://www.php.net/distributions/php-8.5.7.tar.gz
132147
phpSha256Hash: "e5eba93fd6dd3241d0e61e932eb99a3783b40568553fb0e511b660ecd863a049"

0 commit comments

Comments
 (0)