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

Add user id to context config #1962

Merged
merged 3 commits into from Nov 16, 2021

Conversation

jLopezbarb
Copy link
Contributor

Signed-off-by: Javier López Barba javier@okteto.com

Proposed changes

  • Adds user id from deprecated token
  • After upgrading it will create the required field on the first okteto command

Signed-off-by: Javier López Barba <javier@okteto.com>
@jLopezbarb jLopezbarb requested a review from a team November 11, 2021 12:54
@@ -152,6 +152,14 @@ func getUserContext(ctx context.Context) (*okteto.UserContext, error) {
retries := 0
for retries <= 3 {
userContext, err := client.GetUserContext(ctx)

if okteto.Context().UserID == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

could we add a comment explaining why we need this code?

@codecov
Copy link

codecov bot commented Nov 11, 2021

Codecov Report

Merging #1962 (551dc8a) into master (7e0a3a4) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1962      +/-   ##
==========================================
- Coverage   33.31%   33.29%   -0.02%     
==========================================
  Files         125      125              
  Lines       13941    13947       +6     
==========================================
  Hits         4644     4644              
- Misses       8795     8801       +6     
  Partials      502      502              
Impacted Files Coverage Δ
cmd/context/use.go 0.00% <0.00%> (ø)
pkg/okteto/context.go 18.45% <0.00%> (-0.08%) ⬇️

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 7e0a3a4...551dc8a. Read the comment docs.

Signed-off-by: Javier López Barba <javier@okteto.com>

// If userID is not on context config file we add it and save it.
// this prevents from relogin to actual users
if okteto.Context().UserID == "" {
Copy link
Member

Choose a reason for hiding this comment

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

Should we only run this if it's an okteto context?

Signed-off-by: Javier López Barba <javier@okteto.com>
@pchico83 pchico83 merged commit 20236f8 into master Nov 16, 2021
@pchico83 pchico83 deleted the jlopezbarb/add-user-id-to-context-config branch November 16, 2021 09:09
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

4 participants