Skip to content
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

Remove stack when directory is renamed #5250

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

twz123
Copy link
Member

@twz123 twz123 commented Nov 14, 2024

Description

A directory rename is signaled as a rename with the old name followed by a create with the new name. The applier manager didn't honor this, effectively running the old stack along with the new one.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • Manual test
  • Auto test added

Checklist:

  • My code follows the style guidelines of this project
  • My commit messages are signed-off
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

It's the only required knob from the configuration. Using it directly
makes that clear.

Signed-off-by: Tom Wieczorek <[email protected]>
A directory rename is signaled as a rename with the old name followed
by a create with the new name. The applier manager didn't honor this,
effectively running the old stack along with the new one.

Signed-off-by: Tom Wieczorek <[email protected]>
See: aa704c5 ("Also remove stack when directory is renamed")
Signed-off-by: Tom Wieczorek <[email protected]>
@twz123 twz123 added bug Something isn't working area/controlplane backport/release-1.31 PR that needs to be backported/cherrypicked to the release-1.31 branch labels Nov 14, 2024
@@ -151,7 +150,7 @@ func (m *Manager) runWatchers(ctx context.Context) {
if dir.IsDirectory(event.Name) {
m.createStack(ctx, stacks, event.Name)
}
case fsnotify.Remove:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. The unit test fails on Windows, whereas it works well on Linux. I suspect this is due to the implicit event order which is probably different between Windows and Linux. I can imagine how the Create event for the new name happening before the Rename event for the old name will screw things up. Maybe the fix is more involved than simply reacting on Rename events, as well.

@@ -151,7 +150,7 @@ func (m *Manager) runWatchers(ctx context.Context) {
if dir.IsDirectory(event.Name) {
m.createStack(ctx, stacks, event.Name)
Copy link
Member Author

@twz123 twz123 Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Windows unit test logs, I see paths in the logs like this: stack="C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\TestManager_Rename2408267215\\001/lorem". Note the last slash, which should IMO be a backslash. IIUC the logged value is coming from fsnotify, so something is not normalizing path names there. Note that the slash is a valid separator on Windows, too, albeit not the canonical one.

Copy link
Contributor

The PR is marked as stale since no activity has been recorded in 30 days

@github-actions github-actions bot added Stale and removed Stale labels Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/controlplane backport/release-1.31 PR that needs to be backported/cherrypicked to the release-1.31 branch bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant