-
Notifications
You must be signed in to change notification settings - Fork 266
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
feat: Extend sync-options annotation with Force=true (#525) #526
Conversation
5ac7618
to
7f2ec27
Compare
SonarCloud Quality Gate failed. 0 Bugs No Coverage information |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #526 +/- ##
=======================================
Coverage 54.67% 54.68%
=======================================
Files 41 41
Lines 4635 4636 +1
=======================================
+ Hits 2534 2535 +1
Misses 1905 1905
Partials 196 196
☔ View full report in Codecov by Sentry. |
@crenshaw-dev How would you like to refactor the method in order to reduce the Cognitive Complexity? |
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.
Looks good! Is there any existing unit testing for Replace which we could replicate for Force?
@crenshaw-dev I have found: gitops-engine/pkg/sync/sync_context_test.go Line 755 in c0ffe84
But it seems to me that it just tests that the correct method is used. How the "force" flag is tested? (The "force" mode already exists in ArgoCD. This PR adds just the ability to specify it via an annotation.) |
Any updates on this? |
@n9 good question... I'm not sure how |
Signed-off-by: n9 <n9@users.noreply.github.com>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@crenshaw-dev |
@n9 I believe the mock func (r *MockResourceOps) ApplyResource(ctx context.Context, obj *unstructured.Unstructured, dryRunStrategy cmdutil.DryRunStrategy, force, validate, serverSideApply bool, manager string) (string, error) {
r.SetLastValidate(validate)
r.SetLastServerSideApply(serverSideApply)
r.SetLastServerSideApplyManager(manager)
r.SetLastResourceCommand(kube.GetResourceKey(obj), "apply")
command, ok := r.Commands[obj.GetName()]
if !ok {
return "", nil
}
return command.Output, command.Err
} |
Hey @n9 @crenshaw-dev, any updates on testing this and proceeding forward? IIUC you want to see if force flag is visible via ArgoCD logs when sync happens (application-controller pod)? |
Unfortunately, I have to work on other things. Feel free to complete this PR. |
@crenshaw-dev Implemented unit test. Could you please take a look at this PR when you have some time? Thank you. |
This seems to be obsolete now that #560 has been merged, I think. |
Hi! First of all, thank you for the change! May I ask how (and when) will this be integrated into Argo CD? All I see for gitops-engine is that the latest release is 2 years old here https://pkg.go.dev/github.com/argoproj/gitops-engine?tab=versions |
Implementation for #525, #414, argoproj/argo-cd#5882