Skip to content

Conversation

@sivchari
Copy link
Member

@sivchari sivchari commented Feb 24, 2025

close #21942

Until now, we have logics not to pass context, but was using context.Background or context.TODO. This isn't best practice for Go since if the context isn't passed, the logics are out of control of cancellation. By propagating context correctly makes some advantages. At first, we can cancel all goroutines and some requests (e.g. Git, Helm and http client etc). This can avoid goroutine leaks, so the machine doesn't remain extra cpu and memory. Next, our interfaces are enable to define context at first params surely. This practice makes good impact in the future development.
I think the most concerning is that some interface are changed, so if you have some opinion, let me know about it. Please join us with discussion to improve Argo CD.

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).
  • The title of the PR conforms to the Toolchain Guide
  • 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.
  • 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).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@sivchari sivchari requested a review from a team as a code owner February 24, 2025 10:56
@bunnyshell
Copy link

bunnyshell bot commented Feb 24, 2025

❗ Preview Environment undeploy from Bunnyshell failed

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to try again to remove the environment

@codecov
Copy link

codecov bot commented Feb 24, 2025

Codecov Report

Attention: Patch coverage is 64.68189% with 433 lines in your changes missing coverage. Please review.

Project coverage is 56.07%. Comparing base (db9c82a) to head (bb1d04b).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
pkg/apiclient/apiclient.go 0.00% 70 Missing ⚠️
cmd/argocd/commands/app.go 3.92% 49 Missing ⚠️
cmd/argocd/commands/headless/headless.go 0.00% 26 Missing ⚠️
controller/appcontroller.go 85.00% 9 Missing and 12 partials ⚠️
cmd/argocd/commands/project.go 0.00% 19 Missing ⚠️
applicationset/utils/applicationset_lister.go 0.00% 13 Missing ⚠️
cmd/argocd/commands/account.go 0.00% 12 Missing ⚠️
cmd/argocd/commands/project_role.go 0.00% 11 Missing ⚠️
cmd/argocd/commands/cluster.go 0.00% 10 Missing ⚠️
reposerver/repository/repository.go 91.26% 6 Missing and 3 partials ⚠️
... and 62 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21963      +/-   ##
==========================================
+ Coverage   56.06%   56.07%   +0.01%     
==========================================
  Files         343      343              
  Lines       57545    57573      +28     
==========================================
+ Hits        32262    32286      +24     
- Misses      22633    22645      +12     
+ Partials     2650     2642       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sivchari sivchari force-pushed the refactor-ctx branch 2 times, most recently from 87862b8 to a7a71f9 Compare March 20, 2025 11:38
@sivchari sivchari changed the title [WIP] Refactor about the way to use context.TODO and context.Background feat: Refactor about the way to use context.TODO and context.Background Apr 20, 2025
@sivchari sivchari force-pushed the refactor-ctx branch 4 times, most recently from db4446c to 80f6145 Compare April 20, 2025 15:32
@sivchari sivchari requested a review from a team as a code owner April 20, 2025 15:32
@sivchari sivchari force-pushed the refactor-ctx branch 10 times, most recently from d293908 to 262e38b Compare April 21, 2025 12:51
Comment on lines +296 to +297
github.com/argoproj/gitops-engine => github.com/sivchari/gitops-engine v0.0.0-20250421124833-45bcf5629986
github.com/argoproj/notifications-engine => github.com/sivchari/notifications-engine v0.0.0-20250420144357-6843172f87f1
Copy link
Member Author

Choose a reason for hiding this comment

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

It should be replaced before this PR is merged.

@sivchari sivchari force-pushed the refactor-ctx branch 3 times, most recently from 8be83f1 to e3d4897 Compare April 22, 2025 08:48
@sivchari
Copy link
Member Author

sivchari commented Apr 22, 2025

Hi @crenshaw-dev
I believe this PR is so important for Argo CD. It should take your time, but please take a look these changes. 🙏
I want to merge it surely.
Or if you don't have time to review it, please tell me who can review it.

@sivchari
Copy link
Member Author

@gdsoumya @blakepettersson PTAL 🙏

@sivchari sivchari force-pushed the refactor-ctx branch 3 times, most recently from 7d46ef1 to 64c1c05 Compare April 29, 2025 17:45
Signed-off-by: sivchari <[email protected]>
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.

Propagate Context from entry point to some functions to replace Background/TODO

1 participant