[kde-linux/os-autoinst-distri-kdelinux] /: Make CI friendlier for maintainers
Thomas Duckworth <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 82027dbd7b8e909725737155f16c40698cbc9418 by Thomas Duckworth.
Committed on 18/07/2026 at 12:27.
Pushed by tduck into branch 'master'.
Make CI friendlier for maintainers
Shows a more descriptive message when a job starts running. Provides a
link to view staged assets in CI. Collects and uploads JUnit XML to
GitLab to create reports.
M +9 -0 .gitlab-ci.yml
M +8 -1 lib/openqa/cli_test.py
A +29 -0 utils/banner.sh
M +4 -17 utils/run_job.sh
M +24 -5 worker.sh
https://invent.kde.org/kde-linux/os-autoinst-distri-kdelinux/-/commit/82027dbd7b8e909725737155f16c40698cbc9418
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9dd8c86..57523c3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -40,6 +40,7 @@ reuse:
--entrypoint ""
--volume $CI_PROJECT_DIR:$CI_PROJECT_DIR:z
--workdir $CI_PROJECT_DIR
+ --env CI_PROJECT_DIR
--env OPENQA_HOST_ADDR
--env OPENQA_API_KEY
--env OPENQA_API_SECRET
@@ -49,6 +50,14 @@ reuse:
registry.opensuse.org/devel/openqa/containers16.0/openqa_worker:latest
bash worker.sh $WORKER_ARGS
+ artifacts:
+ when: always
+ reports:
+ junit:
+ - gitlab-artifacts/*-results.xml
+ paths:
+ - gitlab-artifacts/
+
test:
extends: .test-base
stage: test
diff --git a/lib/openqa/cli_test.py b/lib/openqa/cli_test.py
index f99c503..f098742 100644
--- a/lib/openqa/cli_test.py
+++ b/lib/openqa/cli_test.py
@@ -89,8 +89,15 @@ class CliTest:
session.get(self._remote_results, local_results)
upname = f'{self.name}-results.xml'
+
Path('ulogs').mkdir(exist_ok=True)
- shutil.copy(local_results, f'ulogs/{upname}')
+ shutil.copy2(local_results, Path('ulogs') / upname)
+
+ ci_project_dir = os.environ.get("CI_PROJECT_DIR")
+ if ci_project_dir:
+ gitlab_artifact_dir = Path(ci_project_dir) / "gitlab-artifacts"
+ gitlab_artifact_dir.mkdir(parents=True, exist_ok=True)
+ shutil.copy2(local_results, gitlab_artifact_dir / upname)
# There's no nice testapi function to do this in python, so we have to call the underlying perl
perl.eval(f"""
diff --git a/utils/banner.sh b/utils/banner.sh
new file mode 100644
index 0000000..fab0d1c
--- /dev/null
+++ b/utils/banner.sh
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
+# SPDX-FileCopyrightText: 2026 Thomas Duckworth <[email protected]>
+set -euo pipefail
+
+banner() {
+ local level="$1" message="$2"
+ local rule color out=1
+
+ case "$level" in
+ ERROR) rule='\e[1;91m'; color='\e[1;91m'; out=2 ;;
+ WARN) rule='\e[1;93m'; color='\e[1;93m'; out=2 ;;
+ *) rule='\e[1;95m'; color='\e[1;96m' ;;
+ esac
+
+ local line='━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
+ local message_line
+ local prefix="[$level]"
+
+ {
+ printf '\n%b%s\e[0m\n' "$rule" "$line"
+
+ while IFS= read -r message_line || [[ -n "$message_line" ]]; do
+ printf '%-9s %b%s\e[0m\n' "$prefix" "$color" "$message_line"
+ prefix=''
+ done <<< "$message"
+
+ printf '%b%s\e[0m\n\n' "$rule" "$line"
+ } >&"$out"
+}
diff --git a/utils/run_job.sh b/utils/run_job.sh
index b5a7cc3..0c3b35d 100755
--- a/utils/run_job.sh
+++ b/utils/run_job.sh
@@ -3,6 +3,8 @@
# SPDX-FileCopyrightText: 2026 Thomas Duckworth <[email protected]>
set -euo pipefail
+source "$CASEDIR"/utils/banner.sh
+
# Run an OpenQA job from within a worker.
HDD=
@@ -118,22 +120,6 @@ openqa() {
openqa-cli api --host "${OPENQA_SCHEME:-https}://${OPENQA_HOST_ADDR}" "$@"
}
-banner() {
- local level="$1" message="$2"
- local rule color out=1
- case "$level" in
- ERROR) rule='\e[1;91m'; color='\e[1;91m'; out=2 ;; # red
- WARN) rule='\e[1;93m'; color='\e[1;93m'; out=2 ;; # yellow
- *) rule='\e[1;95m'; color='\e[1;96m' ;; # magenta rule, cyan text
- esac
- local line='━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
- {
- printf '\n%b%s\e[0m\n' "$rule" "$line"
- printf '%-9s %b%s\e[0m\n' "[$level]" "$color" "$message"
- printf '%b%s\e[0m\n\n' "$rule" "$line"
- } >&"$out"
-}
-
stage_asset() {
local path="$1"
local name
@@ -200,7 +186,8 @@ poll_openqa_job() {
local scheduled_timeout=30
local scheduled_since=
- banner INFO "View the running job here: ${OPENQA_SCHEME:-https}://${OPENQA_HOST_ADDR}/tests/${job_id}"
+ banner INFO "${TEST} test job is now running.
+View the running job - along with logs - here: ${OPENQA_SCHEME:-https}://${OPENQA_HOST_ADDR}/tests/${job_id}"
local result=
local state=
diff --git a/worker.sh b/worker.sh
index 36364ff..5fff343 100755
--- a/worker.sh
+++ b/worker.sh
@@ -3,6 +3,10 @@
# SPDX-FileCopyrightText: 2026 Thomas Duckworth <[email protected]>
set -eo pipefail
+# Set the casedir to the git repo
+export CASEDIR="$(git rev-parse --show-toplevel)"
+
+source "$CASEDIR"/utils/banner.sh
# Parse cmdline to see if we're doing an upgrade job
UPGRADE=0
while [[ $# -gt 0 ]]; do
@@ -12,9 +16,6 @@ while [[ $# -gt 0 ]]; do
esac
done
-# Set the casedir to the git repo
-export CASEDIR="$(git rev-parse --show-toplevel)"
-
# Get environment variables
if [[ -z "${MOCK_MODE:-}" && -f "$CASEDIR/.env" ]]; then
set -a
@@ -110,8 +111,26 @@ if [[ -n "${MOCK_MODE:-}" ]]; then
fi
# Run test jobs
+jobs_status=0
if [[ "$UPGRADE" -eq 1 ]]; then
- bash "$CASEDIR/utils/jobs.sh" --upgrade
+ if bash "$CASEDIR/utils/jobs.sh" --upgrade; then
+ :
+ else
+ jobs_status=$?
+ fi
else
- bash "$CASEDIR/utils/jobs.sh"
+ if bash "$CASEDIR/utils/jobs.sh"; then
+ :
+ else
+ jobs_status=$?
+ fi
fi
+
+# Send a message to maintainers to tell them where to inspect built images that have been staged.
+if [[ -z "${MOCK_MODE:-}" && -n "${IMAGE_URL:-}" ]]; then
+ URL="https://qoomon.github.io/aws-s3-bucket-browser/index.html?bucket=${IMAGE_URL%/*}"
+ banner INFO "In case of failure, you can inspect and download the .iso image and sysupdate tree at:
+$URL"
+fi
+
+exit "$jobs_status"