[tracker/wip/carlosg/ci-pipelines: 1/7] ci: Add repo-sanity check
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/ci-pipelines: 1/7] ci: Add repo-sanity check
- Date: Mon, 7 Mar 2022 11:28:22 +0000 (UTC)
commit 9cabc41a3700255c4c35668c10806c7217e40ab3
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Feb 17 22:22:17 2022 +0100
ci: Add repo-sanity check
It is somewhat easy to dismiss failed build images as errors in
the pipeline rather than errors in the repository configuration.
Make a separate check in the review stage testing that the user
repository is in a state able to run the rest of CI (e.g. generating
or storing images in its own container registry, since this is
necessary with ci-templates).
The error message is made known through both junit and CI job output.
.gitlab-ci.yml | 17 +++++++++++++++++
.gitlab-ci/simple-junit-report.sh | 17 +++++++++++++++++
2 files changed, 34 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c7ab6deb5..6e698a2a8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,6 +32,18 @@ stages:
reports:
junit: check-junit-report.xml
+repo-sanity:
+ stage: review
+ script:
+ - >
+ if [[ -z "$CI_REGISTRY_IMAGE" ]] ;
+ then
+ .gitlab-ci/simple-junit-report.sh check-junit-report.xml \
+ repo-sanity "The container registry should be enabled in the project general settings panel at
$CI_PROJECT_URL/edit" ;
+ exit 1 ;
+ fi
+ <<: *check
+
check-commit-log:
variables:
GIT_DEPTH: "100"
@@ -130,6 +142,7 @@ build-fedora-container@x86_64:
variables:
GIT_STRATEGY: none
needs:
+ - repo-sanity
- check-commit-log
- check-merge-request
@@ -142,6 +155,7 @@ build-fedora-rawhide-container@x86_64:
GIT_STRATEGY: none
allow_failure: true
needs:
+ - repo-sanity
- check-commit-log
- check-merge-request
@@ -153,6 +167,7 @@ build-fedora-container@aarch64:
variables:
GIT_STRATEGY: none
needs:
+ - repo-sanity
- check-commit-log
- check-merge-request
@@ -164,6 +179,7 @@ build-ubuntu-container@x86_64:
variables:
GIT_STRATEGY: none
needs:
+ - repo-sanity
- check-commit-log
- check-merge-request
@@ -175,6 +191,7 @@ build-alpine-container@x86_64:
variables:
GIT_STRATEGY: none
needs:
+ - repo-sanity
- check-commit-log
- check-merge-request
diff --git a/.gitlab-ci/simple-junit-report.sh b/.gitlab-ci/simple-junit-report.sh
new file mode 100755
index 000000000..120c325f1
--- /dev/null
+++ b/.gitlab-ci/simple-junit-report.sh
@@ -0,0 +1,17 @@
+OUTFILE=$1
+NAME=$2
+MESSAGE=$3
+
+cat >$OUTFILE <<EOF
+<?xml version='1.0' encoding='utf-8'?>
+<testsuites tests="1" errors="0" failures="1">
+ <testsuite name="tracker" tests="1" errors="0" failures="1">
+ <testcase name="$NAME" classname="tracker">
+ <failure message="$MESSAGE"/>
+ </testcase>
+ </testsuite>
+</testsuites>
+EOF
+
+# Also echo the message in stdout for good measure
+echo $MESSAGE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]