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

chore: refactor context handling in cmd/ #9860

Merged
merged 1 commit into from Jul 5, 2022

Conversation

krancour
Copy link
Contributor

@krancour krancour commented Jul 1, 2022

After seeing this comment by @jessesuen, I noticed how pervasive that issue is. I also noticed an overuse of context.Background() in cases where a context either 1. should have been passed in by the caller or 2. should have been obtained from the cobra command.

This PR aims to make how we deal with contexts cleaner and more consistent throughout cmd/. Nothing else is touched and there should be no functional changes in this PR.

Signed-off-by: Kent kent.rancourt@gmail.com

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).

Signed-off-by: Kent <kent.rancourt@gmail.com>
@codecov
Copy link

codecov bot commented Jul 1, 2022

Codecov Report

Merging #9860 (6004064) into master (c1d8173) will decrease coverage by 0.13%.
The diff coverage is 7.37%.

@@            Coverage Diff             @@
##           master    #9860      +/-   ##
==========================================
- Coverage   45.86%   45.73%   -0.14%     
==========================================
  Files         227      227              
  Lines       26864    26953      +89     
==========================================
+ Hits        12322    12327       +5     
- Misses      12862    12946      +84     
  Partials     1680     1680              
Impacted Files Coverage Δ
cmd/argocd-k8s-auth/commands/gcp.go 0.00% <0.00%> (ø)
cmd/argocd/commands/account.go 0.00% <0.00%> (ø)
cmd/argocd/commands/admin/backup.go 0.00% <0.00%> (ø)
cmd/argocd/commands/admin/cluster.go 0.00% <0.00%> (ø)
cmd/argocd/commands/admin/dashboard.go 0.00% <0.00%> (ø)
cmd/argocd/commands/admin/repo.go 0.00% <0.00%> (ø)
cmd/argocd/commands/app.go 20.00% <0.00%> (-0.15%) ⬇️
cmd/argocd/commands/app_actions.go 0.00% <0.00%> (ø)
cmd/argocd/commands/app_resources.go 8.47% <0.00%> (-0.08%) ⬇️
cmd/argocd/commands/cert.go 0.00% <0.00%> (ø)
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1d8173...6004064. Read the comment docs.

Copy link
Collaborator

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

I think since we run the commands with command.Execute instead of command.ExecuteContext, we end up using the background context anyway. But I like the consistency and the single source of truth. Thanks for the refactor!

@crenshaw-dev crenshaw-dev merged commit ae19965 into argoproj:master Jul 5, 2022
@krancour krancour deleted the ctx-fixes branch July 5, 2022 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants