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

feat: Support context switch for argocd-util #7538

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nekia
Copy link
Contributor

@nekia nekia commented Oct 24, 2021

Signed-off-by: Atsushi Neki nekiaiken@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).

Fixes #5912

@nekia
Copy link
Contributor Author

nekia commented Oct 24, 2021

I added context flag as follow:

image

And I've not added ARGOCD_CONTEXT yet because I'm not sure using environment variable manner has consistency with other flags. Should I work on it?

@codecov
Copy link

codecov bot commented Oct 24, 2021

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 45.68%. Comparing base (4606476) to head (062f9b7).
Report is 2 commits behind head on master.

Files Patch % Lines
cmd/argocd/commands/root.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7538   +/-   ##
=======================================
  Coverage   45.67%   45.68%           
=======================================
  Files         353      353           
  Lines       46947    46952    +5     
=======================================
+ Hits        21445    21451    +6     
  Misses      22762    22762           
+ Partials     2740     2739    -1     

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

@wtam2018
Copy link
Contributor

And I've not added ARGOCD_CONTEXT yet because I'm not sure using environment variable manner has consistency with other flags. Should I work on it?
I think just implementing it in the command fine. The strange thing is that I only see one line change in the root.go. Are there more changes to be pushed?

@nekia
Copy link
Contributor Author

nekia commented Oct 25, 2021

@wtam2018 Thank you for the review. No, there is no other than this one line change. In my understanding, basically Context in ClientOptions is expected that it's empty unless you explicitly specify other to use. The Context seems to be complemented by CurrentContext in config when calling ResolveContext.

@nekia
Copy link
Contributor Author

nekia commented Oct 25, 2021

I also noticed from one failure in CI that the newly added --context flag is conflicted with some other existing --context which come from kubectl flag (e.g. argocd admin settings --context [The name of the kubeconfig context to use]). Do we need to change the name of this new flag from --context to other one?

Signed-off-by: Atsushi Neki <nekiaiken@gmail.com>
@nekia
Copy link
Contributor Author

nekia commented Nov 6, 2021

I changed the switch flag from --context to --argocd-context to avoid confusing with kubeconfig context flag , and merged files which were updated by running make clidocsgen.

image

@swerder-coop
Copy link

This simple and realy usefull change still not merged to the master branch, is there any reason for that?
The change #8849 for "--kube-context" made it to production in April 2022
But for use the argocd command on jenkins and allow parallel builds I need the --argocd-context from this issue.

my only workaround without this change is use --config and make different config files for each argocd context

@lionelnicolas
Copy link

Any update on this PR ?

@todaywasawesome
Copy link
Contributor

@nekia I think this stalled primarily because there is a decent workaround with --config but I also still think this is relevant. If you want to fix the conflicts, I think we could get this one merged.

Copy link
Contributor

@todaywasawesome todaywasawesome left a comment

Choose a reason for hiding this comment

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

Lets just fix conflicts.

Signed-off-by: Dan Garfield <dan@codefresh.io>
@nekia nekia requested review from a team as code owners February 15, 2024 15:52
@todaywasawesome todaywasawesome added the lifecycle/rotten Issue/PR had no activity for a long time and should be closed soon label Feb 15, 2024
Copy link
Contributor

@todaywasawesome todaywasawesome left a comment

Choose a reason for hiding this comment

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

Ready to go

@todaywasawesome todaywasawesome enabled auto-merge (squash) February 21, 2024 15:52
Copy link
Member

@pasha-codefresh pasha-codefresh left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@pasha-codefresh
Copy link
Member

@nekia could you please do docsgen again ?

Signed-off-by: pasha-codefresh <pavel@codefresh.io>
@kencochrane
Copy link

It looks like we still have one of the checks failing before we can merge. Anyone know how to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Issue/PR had no activity for a long time and should be closed soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support context switch for argocd-util
7 participants