go install github.com/kilianpaquier/gitlab-storage-cleaner/cmd/gitlab-storage-cleaner@latest
docker run ghcr.io/kilianpaquier/gitlab-storage-cleaner:v1 artifacts
A potential usage can be to schedule a job once a while with given .gitlab-ci.yml
.
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"
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.
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")
Upgrade or install gitlab-storage-cleaner
Usage:
gitlab-storage-cleaner upgrade [flags]
Flags:
--dest string destination directory where gitlab-storage-cleaner will be upgraded / installed (by default "${HOME}/.local/bin")
-h, --help help for upgrade
--major string which major version to upgrade / install (must be of the form "v1", "v2", etc.) - mutually exclusive with --minor option
--minor string which minor version to upgrade / install (must be of the form "v1.5", "v2.4", etc.) - mutually exclusive with --major option
--prereleases whether prereleases are accepted for installation or not
Global Flags:
--log-format string set logging format (either "text" or "json") (default "text")
--log-level string set logging level (default "info")