[Feature] Plugin-Cache Clean Up
Justification
Yikes! Maybe something on a long timer that runs every hour? We wouldn't want to delete plugins that have actually been used though. Maybe we could default to deleting plugins that haven't been accessed for 3 weeks?
Yeah sounds good and viable!
I'd be happy w/ deleting older versions of a given plugin, we had ~40 copies of each of two google providers and that ran us down to 0 bytes of disk space on the volume.
Also, it'd be nice if something (although it might be terraform) didn't leave incomplete versions of these files on disk (we had some that weren't executable, and I presume it's because it was downloading them and ran out of disk before they finished, and thus didn't get to the +x step).
this is also happening in our case, where we use git as the module source. It's frankly ridiculous. A few plans in a span of an hour or two, completely make the Fargate instance (20 GBs of total space) run out of space.
@lkysow Should I create another ticket for this, as it is not solely related to plugins, but for git modules too?
@dimisjim I think the git modules is different as it is a terraform mechanism. To make it worse, the same module can be downloaded several times if used multiple times in the root module (project).
What do you guys think? I have some suggestions. I would like to help!
- a CronJob packed into the docker image
- Make it part of the Go Code
- A sidecar container in the helm chart
A sane, configurable, default for deleting plugins X days/weeks/months old would be ideal for this. you could roll a cron job into the official helm chart but it would be nice if this was just an atlantis param instead
I found this because this is happening to our Atlantis deployment. I'm confused though - because when you run terraform locally, if the providers are already downloaded and you are not running the terraform init -upgrade command, then as far as I know terraform doesn't download the providers every time. So how come its doing it when it's being run by Atlantis?
I would even be ok with a UI option to delete all or select from a tree.
Part of the go code.
It could run after a job completes.
As a workaround, this pre_workflow_hook has been helping me keep my volumes clean
https://github.com/runatlantis/atlantis/issues/3238#issuecomment-1869094337