Commit 293bcb10 authored by hashworks's avatar hashworks
Browse files

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
parents cce3f61a e7423002
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment