summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2022-02-17 22:22:17 +0100
committerCarlos Garnacho <carlosg@gnome.org>2022-03-07 10:04:59 +0100
commit9cabc41a3700255c4c35668c10806c7217e40ab3 (patch)
tree3a4cff2eb6297c11a16bc6f727b588e1add69b7a
parent36625a9807c3a78ba708ced224a4f0e79eb9196a (diff)
downloadtracker-9cabc41a3700255c4c35668c10806c7217e40ab3.tar.gz
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.
-rw-r--r--.gitlab-ci.yml17
-rwxr-xr-x.gitlab-ci/simple-junit-report.sh17
2 files changed, 34 insertions, 0 deletions
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