From 1b6a286c6552dc7947a480e6a1db0038f5cca408 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Tue, 9 Aug 2022 10:32:37 +0000 Subject: [PATCH] post(gl-artifact): artifacts created before 22/6/20 have no expiry --- source/_posts/remove-gitlab-artifacts.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/_posts/remove-gitlab-artifacts.md b/source/_posts/remove-gitlab-artifacts.md index afb387c..be51387 100644 --- a/source/_posts/remove-gitlab-artifacts.md +++ b/source/_posts/remove-gitlab-artifacts.md @@ -10,7 +10,9 @@ On 8 Aug 2022, GitLab [announced](https://docs.gitlab.com/ee/user/usage_quotas.h ## Expire new job artifacts -In all my projects that were using more than 5 GB, 99% of the usage came from job artifacts. I believe most of the cases are like this. The first thing I did is to set *new* job artifacts to expire in a week, the default is [30 days](https://docs.gitlab.com/ee/user/gitlab_com/index.html#gitlab-cicd). Existing job artifact is not affected by this setting. +In all my projects that were using more than 5 GB, 99% of the usage came from job artifacts. I believe most of the cases are like this. The first thing I did was to set *new* job artifacts to expire in a week, the default is [30 days](https://docs.gitlab.com/ee/user/gitlab_com/index.html#gitlab-cicd). Existing job artifacts are not affected by this setting. + +If your job artifacts created in a month are much less than 5 GB in total yet still exceed the quota, it is likely caused by very old artifacts which have no expiry. In that case, reducing the default expiry may not be relevant, those old artifacts should be removed instead. ``` diff .gitlab-ci.yml build: @@ -24,6 +26,8 @@ build: As for cleaning up existing job artifacts, I found the following bash script on the GitLab forum. I fixed some variable typo and modified the starting page to "2", all job artifacts will be removed except for the first page, retaining 100 most recent job artifacts. The only dependencies are **curl** and **jq**. +This script is especially useful for removing job artifacts were created before 22 Jun 2020, artifacts created before that date do not expire. + {% codeblock cleanup-gitlab.sh lang:bash https://forum.gitlab.com/t/remove-all-artifact-no-expire-options/9274/12 source %} #!/bin/bash # https://forum.gitlab.com/t/remove-all-artifact-no-expire-options/9274/12