-
Notifications
You must be signed in to change notification settings - Fork 265
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: Respect original parameter overrides with git write-back #573
feat: Respect original parameter overrides with git write-back #573
Conversation
Codecov Report
@@ Coverage Diff @@
## master #573 +/- ##
==========================================
- Coverage 65.86% 65.63% -0.24%
==========================================
Files 22 22
Lines 2045 2069 +24
==========================================
+ Hits 1347 1358 +11
- Misses 569 577 +8
- Partials 129 134 +5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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 one, thank you!
The linter complained, and it turns out your code shadows err
in one place. Please fix it, otherwise LGTM :)
pkg/argocd/update.go
Outdated
override, err = yaml.Marshal(newParams) | ||
break | ||
} | ||
err := yaml.Unmarshal(originalData, ¶ms) |
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.
err := yaml.Unmarshal(originalData, ¶ms) | |
err = yaml.Unmarshal(originalData, ¶ms) |
Oh, and please make sure the DCO passes by signing off your commits |
f22b5f9
to
0c5761f
Compare
Signed-off-by: KS. Yim <[email protected]>
Signed-off-by: KS. Yim <[email protected]>
Signed-off-by: KS. Yim <[email protected]>
Signed-off-by: KS. Yim <[email protected]>
66f0e2b
to
24246a4
Compare
Signed-off-by: KS. Yim <[email protected]>
24246a4
to
4a9f69d
Compare
Signed-off-by: KS. Yim <[email protected]>
@jannfis The issue described in the PR description has actually caused a disruption to our production(insignificant, though) workload so it would be very nice if I can ship this into the next release. Resolved the variable shadowing issue and signed-off all my commits included in the PR. |
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. Going to merge it without rebase required, because the codegen error is negligible.
…roj-labs#573) * Fix original override not respected Signed-off-by: KS. Yim <[email protected]> * Add writeOverrides unittest Signed-off-by: KS. Yim <[email protected]> * Add helm override commit test Signed-off-by: KS. Yim <[email protected]> * lint Signed-off-by: KS. Yim <[email protected]> * fix shadowed err Signed-off-by: KS. Yim <[email protected]> --------- Signed-off-by: KS. Yim <[email protected]> Co-authored-by: KS. Yim <[email protected]> Signed-off-by: Jarvis Yang <[email protected]>
…roj-labs#573) * Fix original override not respected Signed-off-by: KS. Yim <[email protected]> * Add writeOverrides unittest Signed-off-by: KS. Yim <[email protected]> * Add helm override commit test Signed-off-by: KS. Yim <[email protected]> * lint Signed-off-by: KS. Yim <[email protected]> * fix shadowed err Signed-off-by: KS. Yim <[email protected]> --------- Signed-off-by: KS. Yim <[email protected]> Co-authored-by: KS. Yim <[email protected]> Signed-off-by: Jesse Bye <[email protected]>
Signed-off-by: satoru <[email protected]> Signed-off-by: Jesse Bye <[email protected]> docs: Fixed typo (argoproj-labs#589) Signed-off-by: Jesse Bye <[email protected]> chore: Preallocate space for slices with known size (argoproj-labs#575) Signed-off-by: satoru <[email protected]> Signed-off-by: Jesse Bye <[email protected]> ci: Fix codegen and update kustomize to post-2.0 (argoproj-labs#590) * ci: Fix codegen Signed-off-by: jannfis <[email protected]> * Fix tar call Signed-off-by: jannfis <[email protected]> --------- Signed-off-by: jannfis <[email protected]> Signed-off-by: Jesse Bye <[email protected]> feat: Respect original parameter overrides with git write-back (argoproj-labs#573) * Fix original override not respected Signed-off-by: KS. Yim <[email protected]> * Add writeOverrides unittest Signed-off-by: KS. Yim <[email protected]> * Add helm override commit test Signed-off-by: KS. Yim <[email protected]> * lint Signed-off-by: KS. Yim <[email protected]> * fix shadowed err Signed-off-by: KS. Yim <[email protected]> --------- Signed-off-by: KS. Yim <[email protected]> Co-authored-by: KS. Yim <[email protected]> Signed-off-by: Jesse Bye <[email protected]> chore: Update to newer argocd version for better API compatibility (argoproj-labs#594) * fix: update go mods to use newer argocd app definition Signed-off-by: Jesse Bye <[email protected]> * fix deps and tests Signed-off-by: Jesse Bye <[email protected]> * fix spelling Signed-off-by: Jesse Bye <[email protected]> --------- Signed-off-by: Jesse Bye <[email protected]> chore(deps): upgrade dependencies for fix vulnerabilities (argoproj-labs#599) Signed-off-by: Viacheslav Sychov <[email protected]> Signed-off-by: Jesse Bye <[email protected]> fix: tighten securityContext to comply with restricted PSS (argoproj-labs#600) makes argocd-image-updater compatible with restricted Pod Security Standard Signed-off-by: Takeo Sawada <[email protected]> Signed-off-by: Jesse Bye <[email protected]> feat: Add possibility to specify write-back GIT repository as annotation (argoproj-labs#424) * Add possibility to specify write-back GIT repository as annotation. Signed-off-by: flozzone <[email protected]> * Update golangci-lint to 1.52.2. Signed-off-by: flozzone <[email protected]> * Replace deprecated golangci linters with 'unused' linter. Signed-off-by: flozzone <[email protected]> * Fix Goimport issues. Signed-off-by: flozzone <[email protected]> --------- Signed-off-by: flozzone <[email protected]> Signed-off-by: Jesse Bye <[email protected]> fix: support ocischema.DeserializedImageIndex in registry client Signed-off-by: Jesse Bye <[email protected]> fix test Signed-off-by: Jesse Bye <[email protected]> fix: update go mods to use newer argocd app definition Signed-off-by: Jesse Bye <[email protected]> fix deps and tests Signed-off-by: Jesse Bye <[email protected]> merge master Signed-off-by: Jesse Bye <[email protected]> fix go mods Signed-off-by: Jesse Bye <[email protected]> refactor: use shared function to reduce duplication Signed-off-by: Jesse Bye <[email protected]> fix: update go mods to use newer argocd app definition Signed-off-by: Jesse Bye <[email protected]> fix deps and tests Signed-off-by: Jesse Bye <[email protected]> merge master Signed-off-by: Jesse Bye <[email protected]> fix go mods Signed-off-by: Jesse Bye <[email protected]> Fix after rebase Signed-off-by: Jesse Bye <[email protected]> chore: Fix spell checking config (argoproj-labs#577) Signed-off-by: satoru <[email protected]> docs: Fixed typo (argoproj-labs#589) chore: Preallocate space for slices with known size (argoproj-labs#575) Signed-off-by: satoru <[email protected]> ci: Fix codegen and update kustomize to post-2.0 (argoproj-labs#590) * ci: Fix codegen Signed-off-by: jannfis <[email protected]> * Fix tar call Signed-off-by: jannfis <[email protected]> --------- Signed-off-by: jannfis <[email protected]> feat: Respect original parameter overrides with git write-back (argoproj-labs#573) * Fix original override not respected Signed-off-by: KS. Yim <[email protected]> * Add writeOverrides unittest Signed-off-by: KS. Yim <[email protected]> * Add helm override commit test Signed-off-by: KS. Yim <[email protected]> * lint Signed-off-by: KS. Yim <[email protected]> * fix shadowed err Signed-off-by: KS. Yim <[email protected]> --------- Signed-off-by: KS. Yim <[email protected]> Co-authored-by: KS. Yim <[email protected]> chore: Update to newer argocd version for better API compatibility (argoproj-labs#594) * fix: update go mods to use newer argocd app definition Signed-off-by: Jesse Bye <[email protected]> * fix deps and tests Signed-off-by: Jesse Bye <[email protected]> * fix spelling Signed-off-by: Jesse Bye <[email protected]> --------- Signed-off-by: Jesse Bye <[email protected]> chore(deps): upgrade dependencies for fix vulnerabilities (argoproj-labs#599) Signed-off-by: Viacheslav Sychov <[email protected]> fix: tighten securityContext to comply with restricted PSS (argoproj-labs#600) makes argocd-image-updater compatible with restricted Pod Security Standard Signed-off-by: Takeo Sawada <[email protected]>
…roj-labs#573) * Fix original override not respected Signed-off-by: KS. Yim <[email protected]> * Add writeOverrides unittest Signed-off-by: KS. Yim <[email protected]> * Add helm override commit test Signed-off-by: KS. Yim <[email protected]> * lint Signed-off-by: KS. Yim <[email protected]> * fix shadowed err Signed-off-by: KS. Yim <[email protected]> --------- Signed-off-by: KS. Yim <[email protected]> Co-authored-by: KS. Yim <[email protected]> Signed-off-by: Francesc Arbona <[email protected]>
…roj-labs#573) * Fix original override not respected Signed-off-by: KS. Yim <[email protected]> * Add writeOverrides unittest Signed-off-by: KS. Yim <[email protected]> * Add helm override commit test Signed-off-by: KS. Yim <[email protected]> * lint Signed-off-by: KS. Yim <[email protected]> * fix shadowed err Signed-off-by: KS. Yim <[email protected]> --------- Signed-off-by: KS. Yim <[email protected]> Co-authored-by: KS. Yim <[email protected]>
…roj-labs#573) * Fix original override not respected Signed-off-by: KS. Yim <[email protected]> * Add writeOverrides unittest Signed-off-by: KS. Yim <[email protected]> * Add helm override commit test Signed-off-by: KS. Yim <[email protected]> * lint Signed-off-by: KS. Yim <[email protected]> * fix shadowed err Signed-off-by: KS. Yim <[email protected]> --------- Signed-off-by: KS. Yim <[email protected]> Co-authored-by: KS. Yim <[email protected]>
Modification:
Make image-updater respect the original parameter overrides written in
.argocd-source-<appName>.yaml
.Motivation:
Currently, the original overridden parameters stored in
.argocd-source-<appName>.yaml
are not respected when image-updater writes back its change to git.
Imagine that a user has originally defined
.argocd-source-<appName>.yaml
like below...and image-updater wants to write back the additional overrides below
foo.image.repository: foo
foo.image.tag: 2.0.0
The user may want the edited file to be like...
... but what's actually committed to git is the following and it deletes the original user-defined parameter overrides.
And this image-updater behavior is a suspected cause of #562 and the likes
as image-updater ignores the tags for an image that it failed to fetch when
there are multiple updatable images defined in an
Application
and generatethe parameter overrides without the ignored image.
If only a part of image tags were successfully fetched from the image registry
due to unstable network, image-updater may write a broken parameter override
file to git.