-
Notifications
You must be signed in to change notification settings - Fork 804
fix: Always refresh the default hooks during upgrades #5009
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
Here's an example that reproduces and then fixes the issue:
|
Another PR fixed one of the default hooks [1], however we're not copying over the hooks from $SNAP/default-hooks to $SNAP/hooks when refreshing existing snap installations [2]. This is probably by design so that we don't override user defined hooks However, it doesn't seem to be documented anywhere. As suggested by the team, this patch will copy over the reconcile.d/10-pods-restart hook. Downsides: * copying just one of the hooks seems a bit unintuitive and inconsistent * we may override user hooks, which can be unexpected Alternatives: * document the fact that these hooks are not refreshed automatically and that users can/should copy over the default hooks * always refresh all hooks [1] #4819 [2] #4819 (comment)
At the moment, the default hooks are not updated when refreshing the snap. There's an explicit check so this was most probably by design so that custom hooks would not get overriden. However, it means that bug fixes are not applied automatically and the users need to copy the files manually, which is undocumented and not very user friendly. This change will always refresh the default hooks, replacing the existing files. Custom hooks are expected to use separate files so that they won't get overriden during upgrades.
375bb78
to
e65071b
Compare
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.
LGTM
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.
LGTM, one final change
356b413
to
94105c1
Compare
94105c1
to
4509992
Compare
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.
Nice work @petrutlucian94!
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.
LGTM
88e914d
to
7ed45dc
Compare
We'll use the same workaround as k8s-snap.
7ed45dc
to
a0b851d
Compare
/backport |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 1.32
git worktree add -d .worktree/backport-5009-to-1.32 origin/1.32
cd .worktree/backport-5009-to-1.32
git switch --create backport-5009-to-1.32
git cherry-pick -x 0f715dbef8fed519de7e97cf2b4e862135e00944 |
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 1.32-strict
git worktree add -d .worktree/backport-5009-to-1.32-strict origin/1.32-strict
cd .worktree/backport-5009-to-1.32-strict
git switch --create backport-5009-to-1.32-strict
git cherry-pick -x 0f715dbef8fed519de7e97cf2b4e862135e00944 |
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
(cherry picked from commit 0f715db)
Always refresh the default hooks during upgrades
At the moment, the default hooks are not updated when refreshing
the snap[1].
There's an explicit check so this was most probably by design so that
custom hooks would not get overridden[2]. However, it means that bug
fixes are not applied automatically and the users need to copy the
files manually, which is undocumented and not very user friendly.
Warning:
This change will always refresh the default hooks, replacing
the existing files. Custom hooks are expected to use separate files
so that they won't get overridden during upgrades.
[1] #4819
[2] #4819 (comment)
Summary
Changes
Testing
Possible Regressions
Checklist
Notes