Table of Contents
Gitlab Project doctor is a CLI tool to clean up Gitlab repositories, especially (for now) :
- Old pipelines (with jobs and jobs artifacts)
- Obsolete packages from package registry
It has first class support on Windows, macOS and Linux, with binary downloads available for every release .
- Download the latest release for your OS
- Unzip and make gitlab-project-doctor executable
chmod +x gitlab-project-doctor
- The environment variable GL_TOKEN needs to be set with a private token with
sufficient privileges (owner of a project). For instance, on Linux :
read -s GL_TOKEN # To secretly set the variable
- You can analyze a project from a local Git path whose first remote is a
gitlab repository
cd my_favorite_gitlab_repo gitlab-project-doctor .
- Or you can analyze a project from a remote Gitlab repository
gitlab-project-doctor --url https://<your-gitlab-repo.com>/your-project-path
On Gitlab, if you allow duplicate packages (same name, same version), when you upload a package, the former one is not deleted. gitlab-project-doctor detects :
- Generic duplicate packages: same name, same version
- Maven SNAPSHOT duplicate packages: same artifactId, same SNAPSHOT version.
You can use gitlab-project-doctor in batch mode, for example in a CI/CD job.
In a Gitlab environment, here is an example of job declaration :
# A job in the .gitlab-ci.yml file of the project you want to clean
clean_project:
image: $CI_REGISTRY/pub/numeco/gitlab-project-doctor:latest
variables:
# You need to declare a project-based private token with **owner** privilege
GL_TOKEN: $GL_WRITE_TOKEN
stage: build
# The option -b activates the batch mode
# The option -d specifies the number of days
script:
- gitlab-project-doctor --url $CI_PROJECT_URL -b -d 30
- Initial release with generic and maven packages detection
- Internationalization (French)
- Batch-mode and container image (Alpine-based)
- Container registry
- Fat git repositories
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag " enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Geoffrey Arthaud - numerique-ecologie@developpement-durable.gouv.fr
- ripgrep project for Github actions