Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/ci/docker-compose.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
- SNAPSHOT_REGEX_PLACEHOLDERS=path:/home/circleci/app|/project/dd-trace-php,httpbin:(?<=//)httpbin-integration:8080

request-replayer:
image: datadog/dd-trace-ci:php-request-replayer-2.0
image: datadog/request-replayer:3.0

httpbin-integration:
image: kong/httpbin:0.2.2
Expand Down
2 changes: 1 addition & 1 deletion .claude/ci/package-native-verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ docker network create verify-net 2>/dev/null || true
docker rm -f replayer 2>/dev/null || true
docker run -d --name replayer --network verify-net \
--network-alias request-replayer \
datadog/dd-trace-ci:php-request-replayer-2.0
datadog/request-replayer:3.0

.claude/ci/dockerh --cache verify-debian-83 --overlayfs --root \
debian:bookworm-slim \
Expand Down
2 changes: 1 addition & 1 deletion .claude/ci/tracer-integration-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ substring.
| Service | Image | Alias | Port | Purpose |
|---------|-------|-------|------|---------|
| test-agent | `ddapm-test-agent:v1.22.1` | `test-agent` | 9126 | Receives traces; validates snapshots |
| request-replayer | `dd-trace-ci:php-request-replayer-*` | `request-replayer` | 80 | HTTP request replay |
| request-replayer | `request-replayer:*` | `request-replayer` | 80 | HTTP request replay |
| httpbin | `kong/httpbin:0.2.2` | `httpbin-integration` | 8080 | HTTP echo service |

### Additional services by target substring
Expand Down
2 changes: 1 addition & 1 deletion .claude/ci/tracer-web-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ All web test jobs use four GitLab service containers:
| Service | Image | Alias | Port | Purpose |
|---------|-------|-------|------|---------|
| test-agent | `ddapm-test-agent:v1.22.1` | `test-agent` | 9126 | Receives traces; validates snapshots |
| request-replayer | `dd-trace-ci:php-request-replayer-*` | `request-replayer` | 80 | Replays HTTP requests for trace forwarding |
| request-replayer | `request-replayer:*` | `request-replayer` | 80 | Replays HTTP requests for trace forwarding |
| httpbin | `kong/httpbin:0.2.2` | `httpbin-integration` | 80 | HTTP echo service for curl/guzzle tests |
| mysql | `dd-trace-ci:php-mysql-dev-5.6` | `mysql-integration` | 3306 | MySQL for WordPress, Drupal, Magento, etc. |

Expand Down
46 changes: 37 additions & 9 deletions .gitlab/generate-ci-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Generates the CI image build + publish GitLab child pipeline.
*
* Source of truth (NO duplication):
* - dockerfiles/ci/<os>/docker-compose.yml : service name -> image:TAG
* - dockerfiles/ci/bookworm/.env : $BOOKWORM_NEXT_VERSION etc.
* - each $dirs compose file : service name -> image:TAG
* - dockerfiles/ci/bookworm/.env : $BOOKWORM_NEXT_VERSION etc.
*
* The compose service name is the `docker buildx bake` target and the build
* matrix value; the `image:` tag (with env vars resolved) is the published tag.
Expand Down Expand Up @@ -39,7 +39,18 @@ function substitute(string $s, array $env): string
}, $s);
}

// Parse a docker-compose.yml into [service => tag], preserving file order.
// Compose's own filename precedence; the first that exists wins.
function compose_file(string $dir): string
{
foreach (["compose.yaml", "compose.yml", "docker-compose.yaml", "docker-compose.yml"] as $name) {
if (is_file("$dir/$name")) {
return "$dir/$name";
}
}
return "$dir/compose.yaml"; // nonexistent: the caller fails on the empty parse
}

// Parse a compose file into [service => tag], preserving file order.
function parse_compose(string $path, array $env): array
{
$services = [];
Expand Down Expand Up @@ -75,24 +86,32 @@ function parse_compose(string $path, array $env): array
"Bookworm" => "dockerfiles/ci/bookworm",
"CentOS" => "dockerfiles/ci/centos/7",
"Alpine" => "dockerfiles/ci/alpine_compile_extension",
"Services" => "dockerfiles/services",
];

$registryOverrides = [
"Services" => "registry.ddbuild.io/ci/dd-trace-php/request-replayer",
];

$osList = [];
foreach ($dirs as $os => $dir) {
$services = parse_compose("$root/$dir/docker-compose.yml", parse_env("$root/$dir/.env"));
$services = parse_compose(compose_file("$root/$dir"), parse_env("$root/$dir/.env"));
if (!$services) {
fwrite(STDERR, "WARNING: no services parsed for $os ($dir)\n");
continue;
// Continuing would emit a valid-looking pipeline with this OS's jobs
// silently missing, so fail the generator instead.
fwrite(STDERR, "ERROR: no services parsed for $os ($dir)\n");
exit(1);
}
$osList[] = ["name" => $os, "dir" => $dir, "services" => $services];
}

// Windows is single-arch (no multi-arch manifest) and uses a different build
// runner/script, so it is emitted separately from the Linux loop below. It has
// no .env, so tags resolve with an empty env map.
$winServices = parse_compose("$root/dockerfiles/ci/windows/docker-compose.yml", []);
$winServices = parse_compose(compose_file("$root/dockerfiles/ci/windows"), []);
if (!$winServices) {
fwrite(STDERR, "WARNING: no services parsed for Windows\n");
fwrite(STDERR, "ERROR: no services parsed for Windows\n");
exit(1);
}
?>
# CI image build + publish child pipeline, generated by
Expand Down Expand Up @@ -302,13 +321,17 @@ function parse_compose(string $path, array $env): array
<?php foreach ($osList as ['name' => $os, 'dir' => $dir, 'services' => $services]): ?>
<?php /*
One build job per PHP version. buildx bake reads the x-bake platforms from
docker-compose.yml and builds both arches on the amd64 runner's "ci" builder,
the compose file and builds both arches on the amd64 runner's "ci" builder,
pushing a multi-arch manifest to the tag in the compose `image:` field.
*/ ?>

<?= $os ?> build:
extends: .linux_image_build
tags: ["arch:amd64"]
<?php if ($registry = $registryOverrides[$os] ?? null): ?>
variables:
CI_REGISTRY_IMAGE: "<?= $registry ?>"
<?php endif; ?>
parallel:
matrix:
<?php foreach ($services as $svc => $tag): ?>
Expand All @@ -334,6 +357,11 @@ function parse_compose(string $path, array $env): array

<?= $os ?> publish:
extends: .image_publish
<?php if ($registry = $registryOverrides[$os] ?? null): ?>
variables:
CI_REGISTRY_IMAGE: "<?= $registry ?>"
IMG_DESTINATIONS: "<?= basename($registry) ?>:${TAG}"
<?php endif; ?>
parallel:
matrix:
- TAG:
Expand Down
3 changes: 2 additions & 1 deletion .gitlab/generate-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,12 @@ function windows_git_setup_with_packages() {
KUBERNETES_SERVICE_MEMORY_LIMIT: 512Mi

request-replayer:
name: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-request-replayer-2.0
name: registry.ddbuild.io/ci/dd-trace-php/request-replayer:3.0
alias: request-replayer
command: ["php", "-S", "<?= $service_bind_address ?>:80", "index.php"]
variables:
DD_REQUEST_DUMPER_FILE: dump.json
PHP_CLI_SERVER_WORKERS: "16"
KUBERNETES_SERVICE_CPU_REQUEST: 2
KUBERNETES_SERVICE_CPU_LIMIT: 2
KUBERNETES_SERVICE_MEMORY_REQUEST: 1Gi
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/generate-tracer.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function before_script_steps($with_docker_auth = false) {
# Start the container network and services
docker network create -d "nat" -o com.docker.network.windowsshim.dnsservers="1.1.1.1" net
docker run --network net -d --name httpbin-integration registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:httpbin-windows
docker run --network net -d --name request-replayer registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-request-replayer-2.0-windows
docker run --network net -d --name request-replayer registry.ddbuild.io/ci/dd-trace-php/dd-trace-ci:php-request-replayer-3.0_windows
docker run -v ${pwd}:C:\Users\ContainerAdministrator\app --network net -d --name ${CONTAINER_NAME} ${IMAGE} ping -t localhost

# Enable NTFS long path support so cargo's libgit2-based git checkouts of
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ services:
- DD_API_KEY=invalid_key_but_its_ok

request-replayer:
image: datadog/dd-trace-ci:php-request-replayer-2.0
image: datadog/request-replayer:3.0
ports:
- "8766:80"

Expand Down Expand Up @@ -295,7 +295,7 @@ services:


windows-request-replayer:
image: datadog/dd-trace-ci:php-request-replayer-2.0-windows
image: datadog/dd-trace-ci:php-request-replayer-3.0_windows
ports:
- "8766:80"
networks:
Expand Down
8 changes: 8 additions & 0 deletions dockerfiles/ci/windows/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,11 @@ services:
vsVersion: "vc15"
phpTarGzUrl: https://www.php.net/distributions/php-7.2.34.tar.gz
phpSha256Hash: 8b2777c741e83f188d3ca6d8e98ece7264acafee86787298fae57e05d0dddc78

request-replayer:
image: ${CI_REGISTRY_IMAGE:-datadog/dd-trace-ci}:php-request-replayer-3.0_windows
build:
platforms:
- windows/amd64
context: ../../services/request-replayer
dockerfile: windows.Dockerfile
2 changes: 2 additions & 0 deletions dockerfiles/services/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REQUEST_REPLAYER_CURRENT_VERSION=2.0
REQUEST_REPLAYER_NEXT_VERSION=3.0
8 changes: 0 additions & 8 deletions dockerfiles/services/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ redis_publish: redis_build
mysql_publish: redis_build
docker buildx build --platform=linux/amd64 -t $(MYSQL_IMAGE) mysql --push

# It requires buildx to be able to build cross-architecture images
request-replayer_linux_push:
docker buildx build --platform=linux/arm64,linux/amd64 -t datadog/dd-trace-ci:php-request-replayer-2.0 ./request-replayer -f request-replayer/linux.Dockerfile --push

request-replayer_windows_push:
docker build -t datadog/dd-trace-ci:php-request-replayer-2.0-windows ./request-replayer -f request-replayer/windows.Dockerfile
docker push datadog/dd-trace-ci:php-request-replayer-2.0-windows

httpbin_windows_push:
docker build -t datadog/dd-trace-ci:httpbin-windows ./windows-httpbin -f windows-httpbin/Dockerfile
docker push datadog/dd-trace-ci:httpbin-windows
11 changes: 11 additions & 0 deletions dockerfiles/services/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:

request-replayer:
image: ${CI_REGISTRY_IMAGE:-datadog/request-replayer}:$REQUEST_REPLAYER_NEXT_VERSION
build:
context: request-replayer
dockerfile: linux.Dockerfile
x-bake:
platforms:
- linux/arm64
- linux/amd64
Loading
Loading