gitlab: pull before_script logic into .base_meson_job_template
This ensures that all jobs have the $JOBS env set and capture the packages.txt content (where available) in their logs, and all use the job section headers. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-6-berrange@redhat.com Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Daniel P. Berrangé committed
Jun 24, 2026 at 13:46 UTC
3fbac8fc83ed1c73c968fd5f068acf1c840c369e
3 files changed
+11
-34
.gitlab-ci.d/base.yml
+9
@@ -148,6 +148,15 @@ variables:
148
- build/meson-logs
149
reports:
150
junit: build/meson-logs/*.junit.xml
151
+ before_script:
152
+ - source scripts/ci/gitlab-ci-section
153
+ - section_start setup "Pre-script setup"
154
+ - JOBS=$(expr $(nproc) + 1)
155
+ # Prevent logs (if any) from prior build job artifacts
156
+ # from being duplicated in the new job artifacts
157
+ - rm -f build/meson-logs/*
158
+ - test -f /packages.txt && cat /packages.txt
159
+ - section_end setup
160
161
.base_meson_ccache_job_template:
162
extends: .base_meson_job_template
.gitlab-ci.d/buildtest-template.yml
+2
-22
@@ -3,12 +3,6 @@
3
extends: .base_meson_ccache_job_template
4
stage: build
5
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
6
- before_script:
7
- - source scripts/ci/gitlab-ci-section
8
- - section_start setup "Pre-script setup"
9
- - JOBS=$(expr $(nproc) + 1)
10
- - cat /packages.txt
11
- - section_end setup
6
script:
7
- !reference [.base_meson_ccache_job_template, script]
8
- du -sh .git
@@ -74,11 +68,6 @@
68
69
.native_test_job_template:
70
extends: .common_test_job_template
77
- before_script:
78
- # Prevent logs from the build job that run earlier
79
- # from being duplicated in the test job artifacts
80
- - rm -f build/meson-logs/*
81
-
71
72
.functional_test_job_template:
73
extends: .common_test_job_template
@@ -96,27 +85,18 @@
85
- build/tests/functional/*/*/*.log
86
reports:
87
junit: build/meson-logs/*.junit.xml
99
- before_script:
100
- - export QEMU_TEST_ALLOW_UNTRUSTED_CODE=1
101
- - export QEMU_TEST_CACHE_DIR=${CI_PROJECT_DIR}/functional-cache
102
- # Prevent logs from the build job that run earlier
103
- # from being duplicated in the test job artifacts
104
- - rm -f build/meson-logs/*
88
after_script:
89
- cd build
90
- du -chs ${CI_PROJECT_DIR}/*-cache
91
variables:
92
QEMU_JOB_FUNCTIONAL: 1
93
+ QEMU_TEST_ALLOW_UNTRUSTED_CODE: 1
94
+ QEMU_TEST_CACHE_DIR: ${CI_PROJECT_DIR}/functional-cache
95
96
.wasm_build_job_template:
97
extends: .base_meson_job_template
98
stage: build
99
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
115
- before_script:
116
- - source scripts/ci/gitlab-ci-section
117
- - section_start setup "Pre-script setup"
118
- - JOBS=$(expr $(nproc) + 1)
119
- - section_end setup
100
script:
101
- du -sh .git
102
- mkdir build
.gitlab-ci.d/crossbuild-template.yml
-12
@@ -3,12 +3,6 @@
3
stage: build
4
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
5
timeout: 80m
6
- before_script:
7
- - source scripts/ci/gitlab-ci-section
8
- - section_start setup "Pre-script setup"
9
- - JOBS=$(expr $(nproc) + 1)
10
- - cat /packages.txt
11
- - section_end setup
6
script:
7
- !reference [.base_meson_ccache_job_template, script]
8
- mkdir build
@@ -48,9 +42,6 @@
42
stage: build
43
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
44
timeout: 60m
51
- before_script:
52
- - source scripts/ci/gitlab-ci-section
53
- - JOBS=$(expr $(nproc) + 1)
45
script:
46
- !reference [.base_meson_ccache_job_template, script]
47
- mkdir build
@@ -73,9 +64,6 @@
64
extends: .base_meson_ccache_job_template
65
stage: build
66
image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:$QEMU_CI_CONTAINER_TAG
76
- before_script:
77
- - source scripts/ci/gitlab-ci-section
78
- - JOBS=$(expr $(nproc) + 1)
67
script:
68
- !reference [.base_meson_ccache_job_template, script]
69
- mkdir build