From: Don Zickus <dzic...@redhat.com>

CI: ark-create-release: Add a robust check if nothing changed

There are rare cases where upstream hasn't updated and no new 'include
in release' patches were created.  The nightly cron job may stumble upon
no new changes.  This is blocked by the failure of 'make
dist-release-tag'.

Make this a little cleaner by gracefully detecting and exiting.

We do this by saving the original sha head and comparing it to
ark-latest's sha head.  If it hasn't changed then neither os-build nor
ark-latest added new code.  This mean ark-infra won't change either and
there is nothing to tag.  Just exit early.

Signed-off-by: Don Zickus <dzic...@redhat.com>

diff --git a/redhat/scripts/ci/ark-create-release.sh 
b/redhat/scripts/ci/ark-create-release.sh
index blahblah..blahblah 100755
--- a/redhat/scripts/ci/ark-create-release.sh
+++ b/redhat/scripts/ci/ark-create-release.sh
@@ -13,6 +13,7 @@ set -e
 
 git checkout "${BRANCH}"
 touch localversion
+old_head="$(git rev-parse HEAD)"
 make dist-release
 
 # prep ark-latest branch
@@ -25,7 +26,16 @@ for patch_url in $MR_PATCHES; do
        curl -sL "$patch_url" | git am
 done
 
+# if dist-release doesn't update anything, then there is a good chance the
+# tag already exists and infra changes have already been applied.  Let's
+# skip those conditions and exit gracefully.
 make dist-release
+new_head="$(git rev-parse HEAD)"
+if test "$old_head" == "$new_head"; then
+       echo "Nothing changed, skipping updates"
+       exit 0
+fi
+
 make dist-release-tag
 RELEASE=$(git describe)
 git checkout ark-latest

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2518
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to