https://github.com/kilianpaquier/gitlab-storage-cleaner
Easily clean gitlab maintained repositories storage (jobs artifacts only) with a simple command
https://github.com/kilianpaquier/gitlab-storage-cleaner
artifacts cleaner gitlab-ci golang
Last synced: 6 months ago
JSON representation
Easily clean gitlab maintained repositories storage (jobs artifacts only) with a simple command
- Host: GitHub
- URL: https://github.com/kilianpaquier/gitlab-storage-cleaner
- Owner: kilianpaquier
- License: mit
- Created: 2024-02-24T12:05:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-30T10:22:58.000Z (about 1 year ago)
- Last Synced: 2025-03-30T11:22:11.087Z (about 1 year ago)
- Topics: artifacts, cleaner, gitlab-ci, golang
- Language: Go
- Homepage:
- Size: 252 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# gitlab-storage-cleaner
---
- [How to use ?](#how-to-use-)
- [Go](#go)
- [Docker](#docker)
- [Gitlab CICD](#gitlab-cicd)
- [Linux](#linux)
- [Commands](#commands)
- [Artifacts](#artifacts)
## How to use ?
### Go
```sh
go install github.com/kilianpaquier/gitlab-storage-cleaner/cmd/gitlab-storage-cleaner@latest
```
### Docker
```sh
docker run ghcr.io/kilianpaquier/gitlab-storage-cleaner:v1 artifacts
```
### Gitlab CICD
A potential usage can be to schedule a job once a while with given [`.gitlab-ci.yml`](./.gitlab/.gitlab-ci.yml).
### Linux
```sh
OS="linux" # change it depending on your case
ARCH="amd64" # change it depending on your case
INSTALL_DIR="$HOME/.local/bin" # change it depending on your case
new_version=$(curl -fsSL "https://api.github.com/repos/kilianpaquier/gitlab-storage-cleaner/releases/latest" | jq -r '.tag_name')
url="https://github.com/kilianpaquier/gitlab-storage-cleaner/releases/download/$new_version/gitlab-storage-cleaner_${OS}_${ARCH}.tar.gz"
curl -fsSL "$url" | (mkdir -p "/tmp/gitlab-storage-cleaner/$new_version" && cd "/tmp/gitlab-storage-cleaner/$new_version" && tar -xz)
cp "/tmp/gitlab-storage-cleaner/$new_version/gitlab-storage-cleaner" "$INSTALL_DIR/gitlab-storage-cleaner"
```
## Commands
```
Usage:
gitlab-storage-cleaner [command]
Available Commands:
artifacts Clean artifacts of provided project(s)' gitlab storage
completion Generate the autocompletion script for the specified shell
help Help about any command
upgrade Upgrade or install gitlab-storage-cleaner
version Show current gitlab-storage-cleaner version
Flags:
-h, --help help for gitlab-storage-cleaner
--log-format string set logging format (either "text" or "json") (default "text")
--log-level string set logging level (default "info")
Use "gitlab-storage-cleaner [command] --help" for more information about a command.
```
### Artifacts
```
Clean artifacts of provided project(s)' gitlab storage
Usage:
gitlab-storage-cleaner artifacts [flags]
Flags:
--dry-run truthy if run must not delete jobs' artifacts but only list matched projects
-h, --help help for artifacts
--paths strings list of valid regexps to match project path (with namespace)
--server string gitlab server host
--threshold-duration duration threshold duration (positive) where, jobs older than command execution time minus this threshold will be deleted (default 168h0m0s)
--token string gitlab read/write token with maintainer rights to delete artifacts
Global Flags:
--log-format string set logging format (either "text" or "json") (default "text")
--log-level string set logging level (default "info")
```