summaryrefslogtreecommitdiffstats
path: root/screwdriver/delete-old-cloudsmith-artifacts.sh
diff options
context:
space:
mode:
Diffstat (limited to 'screwdriver/delete-old-cloudsmith-artifacts.sh')
-rwxr-xr-xscrewdriver/delete-old-cloudsmith-artifacts.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/screwdriver/delete-old-cloudsmith-artifacts.sh b/screwdriver/delete-old-cloudsmith-artifacts.sh
index d0fea25bc78..9e345646c13 100755
--- a/screwdriver/delete-old-cloudsmith-artifacts.sh
+++ b/screwdriver/delete-old-cloudsmith-artifacts.sh
@@ -10,7 +10,13 @@ curl -1sLf 'https://dl.cloudsmith.io/public/vespa/open-source-rpms/config.rpm.tx
dnf config-manager --add-repo '/tmp/vespa-open-source-rpms.repo'
rm -f /tmp/vespa-open-source-rpms.repo
-VERSIONS_TO_DELETE=$(dnf list -y --quiet --showduplicates --disablerepo='*' --enablerepo=vespa-open-source-rpms vespa | awk '/[0-9].*\.[0-9].*\.[0-9].*/{print $2}' | sort -V | head -n -$MAX_NUMBER_OF_RELEASES | grep -v "7.594.36")
+# Allow the last Vespa 7 release to remain in the repo
+VERSIONS_TO_DELETE=$(dnf list -y --quiet --showduplicates --disablerepo='*' --enablerepo=vespa-open-source-rpms vespa | awk '/[0-9].*\.[0-9].*\.[0-9].*/{print $2}' | sort -V | grep -v "7.594.36" | head -n -$MAX_NUMBER_OF_RELEASES)
+
+if [[ -z "$VERSIONS_TO_DELETE" ]]; then
+ echo "No old RPM versions to delete found. Exiting."
+ exit 0
+fi
RPMS_TO_DELETE=$(mktemp)
trap "rm -f $RPMS_TO_DELETE" EXIT