docker-perl/clean_gitea.sh
Automation Pipeline c47bb9a3c8
Some checks failed
ci/woodpecker/push/generate-perl Pipeline was successful
ci/woodpecker/push/base-os Pipeline was successful
ci/woodpecker/push/build-perls Pipeline failed
Major updates, now adds timestamps for stable tags, also creates a few dozen more types of tags and calculates non-patch tags for future use
2023-10-11 10:46:06 -04:00

26 lines
783 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
# comment out when not dev
#set -x
source .env
# Let this also get pulled from a secret value if needed
GITEA_DOCKER_CLEANER_TOKEN=${GITEA_DOCKER_CLEANER_TOKEN:-$SECRET_DOCKER_CLEANER_TOKEN}
for page in $(seq 30 -1 1); do
PACK_LIST=$(curl --silent -X 'GET' 'https://gitea.simcop2387.info/api/v1/packages/simcop2387?limit=100&page='$page'&type=container&q=perl-container&token='$GITEA_DOCKER_CLEANER_TOKEN -H 'accept: application/json')
if [[ $PACK_LIST != "[]" ]]; then
for version in $(echo $PACK_LIST | jq -r '.[].version'); do
echo $version
curl -X 'DELETE' 'https://gitea.simcop2387.info/api/v1/packages/simcop2387/container/perl-container/'$version'?token='$GITEA_DOCKER_CLEANER_TOKEN -H 'accept: application/json'
done
fi
done