Skip to content

Commit

Permalink
chore: improve cleaner script output
Browse files Browse the repository at this point in the history
  • Loading branch information
esolitos authored and gitbutler-client committed Oct 2, 2024
1 parent 6fbb0ff commit 87b8bef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/scripts/delete-old-cloudsmith-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -o errexit
set -o nounset
set -o pipefail

dnf install -y 'dnf-command(config-manager)' jq
dnf install -yq 'dnf-command(config-manager)' jq

MAX_NUMBER_OF_RELEASES=32
LAST_VESPA_7_RELEASE="7.594.36"
Expand Down Expand Up @@ -44,15 +44,18 @@ for VERSION in $VERSIONS_TO_DELETE; do
"https://api.cloudsmith.io/v1/packages/vespa/open-source-rpms/?query=version:${VERSION}" | jq -re '.[] | .slug' >> $RPMS_TO_DELETE
done

echo "Deleting the following RPMs:"
cat $RPMS_TO_DELETE

if [[ "$GITHUB_EVENT_NAME" == "schedule" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
echo "Deleting the following RPMs:"
cat $RPMS_TO_DELETE

for RPMID in $(cat $RPMS_TO_DELETE); do
curl --silent --show-error --location --fail \
--request DELETE \
--header "X-Api-Key: $CLOUDSMITH_API_TOKEN" \
--header 'accept: application/json' \
"https://api.cloudsmith.io/v1/packages/vespa/open-source-rpms/$RPMID/"
done
else
echo "Dry-run: Would have deleted the following RPMs:"
cat $RPMS_TO_DELETE
fi

0 comments on commit 87b8bef

Please sign in to comment.