Delete CI artifacts on GitLab.com hosted project

My project is using GitLab CI since 2016. Over years it accumulated tons of artifacts. I need to delete them but I cannot find proper API for that, other then selecting thousands checkboxes…

Is there a way to sort artifacts by size?

Is there a way to delete all artifacts till particular date (for example 2019-12-31)?

Is there a way to delete ALL artifacts?

Hi there,

Normally your artifacts expire and get deleted by default - see docs. Therefore I cannot really imagine you have artifacts from 2019…

As far as I know, answer to all of your 3 questions would be - no. You can delete them manually from UI or API. What I would suggest is set lower expire_in option in .gitlab-ci.yml in case you want to save some space. This way they get deleted automatically after they expire.

In case you have some release binaries or other things you should preserve over time, you should upload them to the GitLab Package Registry (or any other long-storage repository / server). Artifacts are meant to be temporary.

Hope this helps! :slight_smile:

Thanks Paula for reply.
I do publish binaries but they go into gitlab pages.

My expiry policy is 2 weeks, and I don’t build frequently because it runs only for master branch. Unless I am deving CI precisely, then it runs more often.
Sometimes there are periods of 3-4 weeks of no new commits to master, so theoretically artifacts should get all expired. They aren’t.
I suspect it may be a bug in some old migrations when upgrading GitLab.com

If by any chance you have more tools to debug, even something simple like sum(size(artifacts)) by year, or sum(count(artifacts)) by year please have a look at the project Rdatatable / data.table · GitLab
It is likely we can track down some bug there.

Is there any support procedure that I could request deletion of ALL artifacts?
Thank you

Hey,

This is just a community forum and I am not from GitLab Team.

I personally don’t know of any tools, neither I am familiar with the background of saving GitLab artifacts.

If you have a GitLab Premium/Ultimate licence, you can open a support ticket here. Otherwise, perhaps some other community member can help you, or eventually someone from GitLab Staff (they occasionally go through community topics).

Best of luck!

1 Like

Hey @jangorecki,

Even my Gitlab Self Managed Instance shows Artifacts as expired but won’t delete them. The Gitlab cron job (under Admin Panel -> Background Jobs -> Cron is set to delete expired artifacts every 7 minutes.

Were you able to figure out why it was behaving weird in your case?

Thanks