Merge branch 'package-registry-cleanup' into 'master'

Remove the rootfses from the package registry after 60 days

Closes #57

See merge request archlinux/archlinux-docker!57
This commit is contained in:
hashworks 2021-04-17 14:19:26 +00:00
commit 293bcb10aa

View File

@ -2,6 +2,7 @@ default:
image: "archlinux:latest"
stages:
- cleanup
- lint
- rootfs
- image
@ -9,6 +10,23 @@ stages:
- release
- publish
cleanup:
stage: cleanup
tags:
- secure
only:
refs:
- schedules
variables:
- $CLEANUP_PACKAGE_REGISTRY == "TRUE"
before_script:
- pacman -Syu --noconfirm jq
script:
- |
for id in $(curl --silent --fail --show-error "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages?per_page=100&order_by=created_at&sort=asc" | jq '.[] | select(.created_at | split("T")[0] | . < (now-60*60*24*60|strflocaltime("%Y-%m-%d"))) | .id'); do
curl --silent --fail --show-error --request DELETE --header "PRIVATE-TOKEN: ${GITLAB_PROJECT_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/${id}"
done
lint:
stage: lint
image: hadolint/hadolint:latest-alpine