-
Notifications
You must be signed in to change notification settings - Fork 888
feat: clean stale provisioner files #9545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -197,6 +197,8 @@ require ( | |||
tailscale.com v1.46.1 | |||
) | |||
|
|||
require github.com/djherbis/times v1.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's super annoying that this isn't exposed in the standard library.
I'm slightly concerned that this module doesn't appear to be very active, but it has no dependencies, so maybe that's OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the self-evaluation of the module, and I agree with you. Fortunately, this is just a basic syscall, so in theory, we could "port" it to coder.
return err | ||
} | ||
|
||
accessTime := info.ModTime() // fallback to modTime if accessTime is not available (afero) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just be aware that modtime is not guaranteed (see: https://www.kernel.org/doc/html/latest/filesystems/api-summary.html?highlight=nocmtime#c.file_update_time)
Howver, I would assume it to at least be the time the file was created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct. I was thinking about running a self-test on the cache directory, but on the other hand I wouldn't like to overcomplicate things.
@johnstcn If you don't mind, I will merge this after the weekend to prevent any unexpected issues 👍 |
👍
|
Fixes: #7107
This PR introduces cleanup logic for stale provisioner files:
I tried to implement a really dumb sweeper that doesn't care about the content but wouldn't like to end up with partially removed plugin files, hence the implementation is plugin-aware.
TODO:
provisioner/terraform/cleanup.go
provisionersdk/cleanup.go