summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-10-06 14:52:21 +0200
committerThomas Haller <thaller@redhat.com>2020-10-06 15:47:29 +0200
commitf9517c7fbb3d72beab99306ddcf9cb552c52c309 (patch)
tree918c20d08cb46d05a1a9f95a188fb7bec330aca7
parent838c3d67951b1a58bce3f812cb6341fdb5a594d4 (diff)
downloadNetworkManager-f9517c7fbb3d72beab99306ddcf9cb552c52c309.tar.gz
build/release: before release check that all gitlab-ci tests ran successfully
-rwxr-xr-xcontrib/fedora/rpm/release.sh38
1 files changed, 37 insertions, 1 deletions
diff --git a/contrib/fedora/rpm/release.sh b/contrib/fedora/rpm/release.sh
index baec7665fd..dd26461f3b 100755
--- a/contrib/fedora/rpm/release.sh
+++ b/contrib/fedora/rpm/release.sh
@@ -52,7 +52,7 @@ echo_color() {
print_usage() {
echo "Usage:"
- echo " $BASH_SOURCE [devel|rc1|rc|major|major-post|minor] [--no-test] [--no-find-backports] [--no-cleanup] [--allow-local-branches]"
+ echo " $BASH_SOURCE [devel|rc1|rc|major|major-post|minor] [--no-test] [--no-find-backports] [--no-cleanup] [--allow-local-branches] [--no-check-gitlab]"
}
die_help() {
@@ -109,6 +109,31 @@ git_same_ref() {
[ "$a" = "$b" ]
}
+check_gitlab_pipeline() {
+ local BRANCH="$1"
+ local SHA="$2"
+ local PIPELINE_ID
+
+ PIPELINE_ID="$(curl --no-progress-meter "https://gitlab.freedesktop.org/api/v4/projects/411/pipelines?ref=$BRANCH&sha=$SHA&order_by=id" 2>/dev/null | jq '.[0].id')"
+ if ! [[ $PIPELINE_ID =~ [0-9]+ ]] ; then
+ echo "Cannot find pipeline for branch $BRANCH. Check \"https://gitlab.freedesktop.org/NetworkManager/NetworkManager/pipelines?page=1&scope=branches&ref=$BRANCH\""
+ return 1
+ fi
+
+ PIPELINE_STATUSES="$(curl --no-progress-meter "https://gitlab.freedesktop.org/api/v4/projects/411/pipelines/$PIPELINE_ID/jobs" 2>/dev/null | jq '.[].status')"
+
+ if ! echo "$PIPELINE_STATUSES" | grep -q '^"success"$' ; then
+ echo "Cannot find successful jobs for branch $BRANCH. Check \"https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/pipelines/$PIPELINE_ID\""
+ return 1
+ fi
+ if echo "$PIPELINE_STATUSES" | grep -q -v '^"success"$' ; then
+ echo "Seems not all jobs for $BRANCH ran (or were successfull). Check \"https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/pipelines/$PIPELINE_ID\""
+ return 1
+ fi
+
+ return 0
+}
+
set_version_number_autotools() {
sed -i \
-e '1,20 s/^m4_define(\[nm_major_version\], \[\([0-9]\+\)\])$/m4_define([nm_major_version], ['"$1"'])/' \
@@ -157,6 +182,7 @@ DRY_RUN=1
FIND_BACKPORTS=1
ALLOW_LOCAL_BRANCHES=0
HELP_AND_EXIT=1
+CHECK_GITLAB=1
while [ "$#" -ge 1 ]; do
A="$1"
shift
@@ -177,6 +203,9 @@ while [ "$#" -ge 1 ]; do
# that differ from upstream. Set this flag to override that check.
ALLOW_LOCAL_BRANCHES=1
;;
+ --no-check-gitlab)
+ CHECK_GITLAB=0
+ ;;
--help|-h)
die_help
;;
@@ -314,6 +343,13 @@ if [ $FIND_BACKPORTS = 1 ]; then
test -z "$TMP" || die "nm-find-backports returned patches that need to be backported (ignore with --no-find-backports): ./.git/nm-find-backports \"$CUR_BRANCH\" master ${NEWER_BRANCHES[@]}"
fi
+if [ $CHECK_GITLAB = 1 ]; then
+ if ! check_gitlab_pipeline "$CUR_BRANCH" "$CUR_HEAD" ; then
+ echo "Check the pipelines for branch \"$CUR_BRANCH\" at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/pipelines/"
+ die "It seems not all gitlab-ci jobs were running/succeeding. Skip this check with --no-check-gitlab"
+ fi
+fi
+
BRANCHES=()
BUILD_TAG=