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

fix: setting spec.SyncPolicy crashes 'argocd appset get' output (#12424) #12425

Conversation

neurodrone
Copy link
Contributor

@neurodrone neurodrone commented Feb 12, 2023

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

Fixes: #12424

Previously we didn't explicitly check for the presence of spec.template.spec.SyncPolicy before accessing its .Automated struct variable which led to a nil pointer dereference issue.

@codecov
Copy link

codecov bot commented Feb 12, 2023

Codecov Report

Base: 47.71% // Head: 47.77% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (1b13627) compared to base (fbb0b99).
Patch coverage: 80.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12425      +/-   ##
==========================================
+ Coverage   47.71%   47.77%   +0.05%     
==========================================
  Files         246      246              
  Lines       41908    41911       +3     
==========================================
+ Hits        19996    20021      +25     
+ Misses      19914    19891      -23     
- Partials     1998     1999       +1     
Impacted Files Coverage Δ
cmd/argocd/commands/applicationset.go 17.05% <80.00%> (+8.27%) ⬆️
util/settings/settings.go 49.36% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@blakepettersson
Copy link
Member

This makes sense to me, is there any chance you could add unit tests for this fix (I'm aware that most of the CLI commands are lacking unit tests, but the boy scout rule and all of that? 😄)?

@neurodrone neurodrone force-pushed the vaibhav/fix-application-set-syncpolicy-segfault branch from 95c93ee to 9ea0a9a Compare February 13, 2023 15:42
@neurodrone
Copy link
Contributor Author

Thanks @blakepettersson for eyeing this! I updated the code with a test to test all permutations of syncPolicies just in case. :) Please let me know if anything else needs to be changed.

Copy link
Member

@blakepettersson blakepettersson left a comment

Choose a reason for hiding this comment

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

LGTM 😄

@neurodrone neurodrone force-pushed the vaibhav/fix-application-set-syncpolicy-segfault branch 2 times, most recently from 58d06cf to 06a5cd2 Compare February 15, 2023 05:11
…proj#12424)

Signed-off-by: Vaibhav Bhembre <vaibhav@digitalocean.com>
@neurodrone neurodrone force-pushed the vaibhav/fix-application-set-syncpolicy-segfault branch from 06a5cd2 to 1b13627 Compare February 16, 2023 18:53
@crenshaw-dev crenshaw-dev merged commit c20b7fe into argoproj:master Feb 17, 2023
crenshaw-dev pushed a commit that referenced this pull request Feb 17, 2023
…) (#12425)

Signed-off-by: Vaibhav Bhembre <vaibhav@digitalocean.com>
crenshaw-dev pushed a commit that referenced this pull request Feb 17, 2023
…) (#12425)

Signed-off-by: Vaibhav Bhembre <vaibhav@digitalocean.com>
@crenshaw-dev
Copy link
Collaborator

Cherry-picked onto release-2.5 for 2.5.12, and release-2.6 for 2.6.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting spec.SyncPolicy hits segfault for ApplicationSets when no spec.template.spec.SyncPolicy is set
3 participants