-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix: manifest-generate-paths with autosync causes an undesirable refresh sync #19799
fix: manifest-generate-paths with autosync causes an undesirable refresh sync #19799
Conversation
Signed-off-by: pashakostohrys <[email protected]>
Signed-off-by: pashakostohrys <[email protected]>
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
@agaudreault Could you please take a look? |
Signed-off-by: pashakostohrys <[email protected]>
This is a big improvement for monorepos with a lot of activity. Well done! |
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.
Thanks @pasha-codefresh for tackling this. The changes looks good to me 🚀
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.
Great win for monorepos!
Signed-off-by: pashakostohrys <[email protected]>
Signed-off-by: pashakostohrys <[email protected]>
Signed-off-by: pashakostohrys <[email protected]>
Signed-off-by: pashakostohrys <[email protected]>
…into feat/monorepo-selfheal-support
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.
Waiting for answer because I have trouble understanding the logic if the boolean is always true.
controller/state.go
Outdated
// by default should be for regular sync, if application has no AnnotationKeyManifestGeneratePaths , it should work as before | ||
revisionUpdated := true |
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.
After this point, nothing is setting the boolean back to false 🤔 so it always returns true, except during error. It looks like this return variable is not necessary.
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.
Yeah, i changed default to true, because it always returned false before for apps that has no AnnotationKeyManifestGeneratePaths annotation. I am reverting it back
Signed-off-by: pashakostohrys <[email protected]>
Signed-off-by: pashakostohrys <[email protected]>
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. Default behavior (when there is no annotation set) is to always return true.
When annotations is set, returns true if at least one revision changed relevant files.
Result: Will not perform an initial "selfHeal" on non-relevant commits the first time drift are detected.
Important note: When annotation is not set, even with selfHeal=false
, it will always trigger a sync once, the first time drift are detected (if AutoSync=true). If the commit that was made did not cause an outOfSync
(e.g. updating a README file), this will be delayed until the first time the app goes OutOfSync (can be caused by cluster changes which will "selfHeal" even if selfHeal=false). So this is fixing the behavior only when annotation is set.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19799 +/- ##
==========================================
+ Coverage 55.79% 55.82% +0.02%
==========================================
Files 320 320
Lines 44223 44250 +27
==========================================
+ Hits 24675 24703 +28
- Misses 16995 16996 +1
+ Partials 2553 2551 -2 ☔ View full report in Codecov by Sentry. |
Yes! thank you! we will cover it with documentation on Monday |
Thank you for everyone to review. I also going to open PR that will cover argocd.argoproj.io/manifest-generate-paths with e2e |
Closes: #18326
alreadyAttemptedSync is deciding if self heal should happens or no, and today we just have check
app.Status.OperationState.SyncResult.Revision != commitSHA
which is not enough, because in monorepo these two revisions can be different.So i have added additional check, which verify if change actually happened in git for current application or no, and if revisions are different but no changes in git for app, self heal will not be executed
Also i am passing resolved revision from UpdateRevisionForPaths response, because if GenerateManifest will accept revision[i] that in most cases HEAD, resolved revision in UpdateRevisionForPaths and GenerateManifest can be different if commit happens between function execution.