Skip to content

New `gdk cleanup` command

Ash McKenzie requested to merge 1342-create-a-new-gdk-cleanup-command into main

What does this Merge Request do and why?

This MR needs !2238 (merged) merged first.

This MR builds upon !2230 (merged) and !2238 (merged) and creates a new gdk cleanup command that runs rake gitlab:truncate_logs as well as rake asdf:uninstall_unnecessary_software.

New diagnostic

$ gdk doctor
.................
⚠️  WARNING: Your GDK may need attention.

asdf
================================================================================
The following asdf software is installed, but doesn't need to be:

redis 6.0.14
yarn 1.22.10

You can uninstall the software above by running:

  rake asdf:uninstall_unnecessary_software

GitLab
================================================================================
Your gitlab/log/ directory is 300MB.  You can truncate the log files if you wish
by running:

  rake gitlab:truncate_logs

Usage

With prompt

$ gdk cleanup
⚠️  WARNING: About to perform the following actions:

- Truncate gitlab/log/* files
- Uninstall any asdf software that is not defined in .tool-versions

Are you sure? [y/N]: y

✅️ Truncated gitlab/log/* files.
Uninstalling redis 6.0.14 ✅️
Uninstalling yarn 1.22.10 ✅️

Bypassing prompt

$ GDK_CLEANUP_CONFIRM=true gdk cleanup
⚠️  WARNING: About to perform the following actions:

- Truncate gitlab/log/* files
- Uninstall any asdf software that is not defined in .tool-versions

✅️ Truncated gitlab/log/* files.
Uninstalling redis 6.0.14 ✅️
Uninstalling yarn 1.22.10 ✅️

Merge Request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise Issue to follow-up.
  • Documentation added/updated, if needed.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.

Closes #1342 (closed)

Edited by Ash McKenzie

Merge request reports