Skip to content

Commit f9fc92c

Browse files
Use the Docker image built by GitLab CI for GitHub jobs (#47)
At the time of writing, the Docker image used for GitHub CI jobs cannot be built anymore: It should be done with `make push-ci-images`. But this fails because the base image `public.ecr.aws/b1o7r7e0/nginx_musl_toolchain:latest` is no more available. To fix this, let's rather use the Docker image built by the GitLab CI. This is documented in the different GitHub jobs configuration files and in the `Makefile`.
1 parent 62ed0d8 commit f9fc92c

File tree

7 files changed

+31
-42
lines changed

7 files changed

+31
-42
lines changed

.github/workflows/dev.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
needs: format
2020
runs-on: ubuntu-22.04
2121
container:
22-
image: datadog/docker-library:httpd-datadog-ci-2.4-cdb3cb2
22+
# See in Makefile where this image comes from.
23+
image: datadog/docker-library:httpd-datadog-ci-28219c0ef3e00f1e3d5afcab61a73a5e9bd2a9b957d7545556711cce2a6262cd
2324
steps:
2425
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2526
with:
@@ -43,7 +44,8 @@ jobs:
4344
needs: build
4445
runs-on: ubuntu-22.04
4546
container:
46-
image: datadog/docker-library:httpd-datadog-ci-2.4-cdb3cb2
47+
# See in Makefile where this image comes from.
48+
image: datadog/docker-library:httpd-datadog-ci-28219c0ef3e00f1e3d5afcab61a73a5e9bd2a9b957d7545556711cce2a6262cd
4749
env:
4850
DD_ENV: ci
4951
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_APP }}
@@ -66,7 +68,7 @@ jobs:
6668
run: pytest --ddtrace test/integration-test --module-path dist/lib/mod_datadog.so --bin-path /httpd/httpd-build/bin/apachectl --log-dir $(pwd)/logs -m ci
6769
- name: Generate code coverage
6870
run: |
69-
llvm-profdata merge -sparse /tmp/*.profraw -o /tmp/default.profdata
71+
llvm-profdata merge -sparse /tmp/*.profraw -o /tmp/default.profdata
7072
llvm-cov export dist/lib/mod_datadog.so -format=lcov -instr-profile=/tmp/default.profdata -ignore-filename-regex=/httpd/ > coverage.lcov
7173
- name: Upload coverage reports to Codecov
7274
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
@@ -76,4 +78,3 @@ jobs:
7678
token: ${{ secrets.CODECOV_TOKEN }}
7779
slug: DataDog/httpd-datadog
7880
fail_ci_if_error: true
79-

.github/workflows/release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ jobs:
55
build:
66
runs-on: ubuntu-22.04
77
container:
8-
image: datadog/docker-library:httpd-datadog-ci-2.4-cdb3cb2
8+
# See in Makefile where this image comes from.
9+
image: datadog/docker-library:httpd-datadog-ci-28219c0ef3e00f1e3d5afcab61a73a5e9bd2a9b957d7545556711cce2a6262cd
910
steps:
1011
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1112
with:

.github/workflows/system-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
build-artifacts:
2020
runs-on: ubuntu-22.04
2121
container:
22-
image: datadog/docker-library:httpd-datadog-ci-2.4-cdb3cb2
22+
# See in Makefile where this image comes from.
23+
image: datadog/docker-library:httpd-datadog-ci-28219c0ef3e00f1e3d5afcab61a73a5e9bd2a9b957d7545556711cce2a6262cd
2324
steps:
2425
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2526
with:

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ build-ci-image:
7373
--push \
7474
--file .gitlab/Dockerfile \
7575
.
76+
echo "Image $IMAGE_TAG built for $ARCH."
7677
fi
7778
artifacts:
7879
reports:

.gitlab/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,11 @@ RUN clang --sysroot /sysroot/${ARCH}-none-linux-musl/ -fpie -O2 -fno-omit-frame-
7878
ar rcs /sysroot/${ARCH}-none-linux-musl/usr/lib/libglibc_compat.a /tmp/glibc_compat.o && \
7979
rm /tmp/glibc_compat.o
8080

81-
8281
# Install dependencies for httpd
83-
RUN apk add --no-cache expat expat-dev autoconf libtool py-pip gpg gpg-agent pcre-dev pcre2-dev zip
82+
RUN apk add --no-cache autoconf expat expat-dev gpg gpg-agent libtool pcre-dev pcre2-dev py-pip zip
83+
84+
# Install dependencies for code coverage upload
85+
RUN apk add --no-cache nodejs npm
8486

8587
# Install Rust toolchain
8688
RUN apk add --no-cache curl
@@ -90,7 +92,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -yq --d
9092
RUN cargo install --locked cbindgen --version 0.26.0 \
9193
&& ln -s ~/.cargo/bin/cbindgen /usr/local/bin/cbindgen
9294

93-
# Install uv (fast Python package manager)
95+
# Install uv (Python package manager)
9496
COPY --from=ghcr.io/astral-sh/uv:0.9.28 /uv /usr/local/bin/uv
9597

9698
# Setup httpd 2.4 source

Dockerfile

Lines changed: 0 additions & 21 deletions
This file was deleted.

Makefile

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
COMMIT_SHA ?= $(shell git rev-parse --short HEAD)
2-
DOCKER_REPO ?= datadog/docker-library
1+
# The CI image used for some GitHub jobs is built by the GitLab build-ci-image job.
2+
# The hash is computed by this GitLab job from the files used to build the image.
3+
#
4+
# Whenever this image needs to be updated, one should:
5+
# - Get the hash from a run of the GitLab build-ci-image job.
6+
# - Copy this hash here, and in the GitHub workflow files.
7+
# - Run: make replicate-ci-image-for-github.
38

4-
.PHONY: push-ci-images
5-
push-ci-images:
6-
docker build --progress=plain --platform linux/amd64 -t $(DOCKER_REPO):httpd-datadog-ci-2.4-$(COMMIT_SHA)-amd64 .
7-
docker push $(DOCKER_REPO):httpd-datadog-ci-2.4-$(COMMIT_SHA)-amd64
8-
docker build --progress=plain --platform linux/arm64 -t $(DOCKER_REPO):httpd-datadog-ci-2.4-$(COMMIT_SHA)-arm64 .
9-
docker push $(DOCKER_REPO):httpd-datadog-ci-2.4-$(COMMIT_SHA)-arm64
10-
docker buildx imagetools create -t $(DOCKER_REPO):httpd-datadog-ci-2.4-$(COMMIT_SHA) \
11-
$(DOCKER_REPO):httpd-datadog-ci-2.4-$(COMMIT_SHA)-amd64 \
12-
$(DOCKER_REPO):httpd-datadog-ci-2.4-$(COMMIT_SHA)-arm64
13-
docker push $(DOCKER_REPO):httpd-datadog-ci-2.4-$(COMMIT_SHA)
9+
CI_DOCKER_IMAGE_HASH ?= 28219c0ef3e00f1e3d5afcab61a73a5e9bd2a9b957d7545556711cce2a6262cd
10+
CI_IMAGE_FROM_GITLAB ?= registry.ddbuild.io/ci/httpd-datadog/amd64:$(CI_DOCKER_IMAGE_HASH)
11+
CI_IMAGE_IN_PUBLIC_REPO_FOR_GITHUB ?= datadog/docker-library:httpd-datadog-ci-$(CI_DOCKER_IMAGE_HASH)
12+
13+
.PHONY: replicate-ci-image-for-github
14+
replicate-ci-image-for-github:
15+
docker pull $(CI_IMAGE_FROM_GITLAB)
16+
docker tag $(CI_IMAGE_FROM_GITLAB) $(CI_IMAGE_IN_PUBLIC_REPO_FOR_GITHUB)
17+
docker push $(CI_IMAGE_IN_PUBLIC_REPO_FOR_GITHUB)

0 commit comments

Comments
 (0)