summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Klausen <kristian@klausen.dk>2024-08-19 01:00:09 +0200
committerKristian Klausen <kristian@klausen.dk>2024-08-19 01:10:02 +0200
commitafa857917261a871a87d803b7bfd808ff505dc87 (patch)
tree64c38b93faba9c3ddf1c0d4345e786434b5adf71
parentc77872be2674bf87a8d76306f0621c76f8a08279 (diff)
Use job token instead of project access token for deleting old packagesHEADmaster
The project access token expired ~3 months ago and apparently the job token has the scopes needed for deleting old packages, so let's just use that instead of creating a new project access token. I assume it was not possible to delete packages with the job token, when this was initially implemented[1]. [1] d04c827 ("Use GitLab's package registry for releases instead of tags")
-rw-r--r--.gitlab-ci.yml2
1 files changed, 1 insertions, 1 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5a05002..7fb4b69 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -207,5 +207,5 @@ cleanup:
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*90|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}"
+ curl --silent --fail --show-error --request DELETE --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/${id}"
done