1
0
Fork 0

ci: Check repo sanity

Check that the container registry in user repositories is
enabled, and issue a more descriptive error around it. Lifted
from Tracker.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3681>
This commit is contained in:
Carlos Garnacho 2024-04-02 10:13:32 +02:00
parent f4b3322b77
commit 3207b9d8c5
2 changed files with 41 additions and 0 deletions

View file

@ -237,6 +237,29 @@ workflow:
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
when: on_success
repo-sanity:
extends:
- .fdo.ci-fairy
stage: review
variables:
GIT_DEPTH: "1"
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
artifacts:
expire_in: 1 week
paths:
- check-junit-report.xml
reports:
junit: check-junit-report.xml
rules:
- !reference [.only-merge-requests, rules]
check-commit-log:
extends:
- .fdo.ci-fairy

View file

@ -0,0 +1,18 @@
#!/bin/bash
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="repo-sanity" tests="1" errors="0" failures="1">
<testcase name="$NAME" classname="repo-sanity">
<failure message="$MESSAGE"/>
</testcase>
</testsuite>
</testsuites>
EOF
# Also echo the message in stdout for good measure
echo $MESSAGE