Skip to content

giantswarm/app-catalog-cleanup-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

262 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

app catalog cleanup tool

build codecov Apache License

A simple tool to remove old Helm charts stored in a chart repository.

How does it work

You specify a removal condition and a regexp to match application names. All chart entries matching the regexp and matching the condition are removed, i.e.:

  • relevant entry is removed from the index.yaml file
  • the chart file is removed
  • if exists, the metadata directory is removed.

For a list of available conditions, please run with --help|-h.

Running

There are currently 2 options:

  1. Using your native python 3 installation.

    • Checkout the source code from repository
    • Run uv sync
    • Start the tool using uv run python -m app_catalog_cleanup_tool ...
  2. Using the dockerized version

    You can use the dockerized version available as a convenience script dacct.sh. Please note, that currently the dockerized version can work on the current directory only, so you have to download the script, make it executable in your system, then run it in the directory with a catalog giving the local directory . as the ast argument.

    Example:

    dacct.sh -a ".*" -s "2020-02-01" -d -n .

Examples

  1. Remove all app entries for the linkerd2-app that are older than '2019-01-01' for the catalog stored in /tmp/giantswarm-playground-catalog

    python -m app_catalog_cleanup_tool -a "linkerd2-app" -s "2019-01-01" /tmp/giantswarm-playground-catalog
  2. Remove all app entries older than 4 weeks for the catalog stored in /tmp/giantswarm-playground-catalog

    python -m app_catalog_cleanup_tool -a ".*" -b "4 weeks" /tmp/giantswarm-playground-catalog
  3. Keep at most the 3 most recent builds of all apps with names starting with "loki"

    python -m app_catalog_cleanup_tool -a "loki.*" -l 3 /tmp/giantswarm-playground-catalog

Development

Use uv to manage dependencies and pre-commit to check for code quality. To get started, check out the repo and run:

uv sync
uv run pre-commit install --install-hooks

Update catalog repos

Since renovate bot doesn't work for catalog repos, one can use a script ./bin/update-catalag-repos. It should be executed from the root of this project.

It depends on yq and github-cli, os both of them must be installed and configured.

About

Removes old Helm charts from a repository

Resources

License

Security policy

Stars

Watchers

Forks

Contributors 13