github: simplify computation of the job's distro

We explicitly list the distro of Linux-based jobs, but it is equivalent to the name of the image in almost all cases, except that colons are replaced with dashes. Drop the redundant information and massage it in our CI scripts, which is equivalent to how we do it in GitLab CI. There are a couple of exceptions: - The "linux32" job, whose distro name is different than the image name. This is handled by adapting all sites to use the new name. - The "alpine" and "fedora" jobs, neither of which specify a tag for their image. This is handled by adding the "latest" tag. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jan 10, 2025 at 12:32 UTC b133d3071ae6c648aced1c40e12914cb6b2ccec9
3 files changed +8 -20
.github/workflows/main.yml
+4 -18
@@ -275,7 +275,7 @@ jobs:
275 CC: ${{matrix.vector.cc}}
276 CC_PACKAGE: ${{matrix.vector.cc_package}}
277 jobname: ${{matrix.vector.jobname}}
278 - distro: ${{matrix.vector.pool}}
278 + CI_JOB_IMAGE: ${{matrix.vector.pool}}
279 TEST_OUTPUT_DIRECTORY: ${{github.workspace}}/t
280 runs-on: ${{matrix.vector.pool}}
281 steps:
@@ -316,63 +316,49 @@ jobs:
316 - jobname: linux-sha256
317 image: ubuntu:latest
318 cc: clang
319 - distro: ubuntu-latest
319 - jobname: linux-reftable
320 image: ubuntu:latest
321 cc: clang
323 - distro: ubuntu-latest
322 - jobname: linux-gcc
323 image: ubuntu:20.04
324 cc: gcc
325 cc_package: gcc-8
328 - distro: ubuntu-20.04
326 - jobname: linux-TEST-vars
327 image: ubuntu:20.04
328 cc: gcc
329 cc_package: gcc-8
333 - distro: ubuntu-20.04
330 - jobname: linux-gcc-default
331 image: ubuntu:latest
332 cc: gcc
337 - distro: ubuntu-latest
333 - jobname: linux-leaks
334 image: ubuntu:latest
335 cc: gcc
341 - distro: ubuntu-latest
336 - jobname: linux-reftable-leaks
337 image: ubuntu:latest
338 cc: gcc
345 - distro: ubuntu-latest
339 - jobname: linux-asan-ubsan
340 image: ubuntu:latest
341 cc: clang
349 - distro: ubuntu-latest
342 - jobname: linux-meson
343 image: ubuntu:latest
344 cc: gcc
353 - distro: ubuntu-latest
345 - jobname: linux-musl
355 - image: alpine
356 - distro: alpine-latest
346 + image: alpine:latest
347 # Supported until 2025-04-02.
348 - jobname: linux32
349 image: i386/ubuntu:focal
360 - distro: ubuntu32-20.04
350 - jobname: pedantic
362 - image: fedora
363 - distro: fedora-latest
351 + image: fedora:latest
352 # A RHEL 8 compatible distro. Supported until 2029-05-31.
353 - jobname: almalinux-8
354 image: almalinux:8
367 - distro: almalinux-8
355 # Supported until 2026-08-31.
356 - jobname: debian-11
357 image: debian:11
371 - distro: debian-11
358 env:
359 jobname: ${{matrix.vector.jobname}}
374 - distro: ${{matrix.vector.distro}}
360 CC: ${{matrix.vector.cc}}
361 + CI_JOB_IMAGE: ${{matrix.vector.image}}
362 runs-on: ubuntu-latest
363 container: ${{matrix.vector.image}}
364 steps:
ci/install-dependencies.sh
+2 -2
@@ -33,7 +33,7 @@ fedora-*|almalinux-*)
33 dnf -yq update >/dev/null &&
34 dnf -yq install shadow-utils sudo make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
35 ;;
36 -ubuntu-*|ubuntu32-*|debian-*)
36 +ubuntu-*|i386/ubuntu-*|debian-*)
37 # Required so that apt doesn't wait for user input on certain packages.
38 export DEBIAN_FRONTEND=noninteractive
39
@@ -42,7 +42,7 @@ ubuntu-*|ubuntu32-*|debian-*)
42 SVN='libsvn-perl subversion'
43 LANGUAGES='language-pack-is'
44 ;;
45 - ubuntu32-*)
45 + i386/ubuntu-*)
46 SVN=
47 LANGUAGES='language-pack-is'
48 ;;
ci/lib.sh
+2
@@ -246,6 +246,8 @@ then
246
247 GIT_TEST_OPTS="--github-workflow-markup"
248 JOBS=10
249 +
250 + distro=$(echo "$CI_JOB_IMAGE" | tr : -)
251 elif test true = "$GITLAB_CI"
252 then
253 CI_TYPE=gitlab-ci