Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

EVEREST-526: Add support for authentication #193

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

ghost
Copy link

@ghost ghost commented Oct 23, 2023

CHANGE DESCRIPTION

Problem:
EVEREST-526

Short explanation of the problem.

Related pull requests

  • [link]

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:

  • Added everestctl login command
  • All other commands automatically use the correct authentication tokens

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?

Tests

  • Is an Integration test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

@codecov-commenter
Copy link

Codecov Report

Merging #193 (ddf882a) into main (2dc4a55) will not change coverage.
The diff coverage is 0.00%.

@@          Coverage Diff          @@
##            main    #193   +/-   ##
=====================================
  Coverage   5.02%   5.02%           
=====================================
  Files         13      13           
  Lines       3005    3005           
=====================================
  Hits         151     151           
  Misses      2827    2827           
  Partials      27      27           
Files Coverage Δ
pkg/install/operators.go 4.60% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

import (
"context"

"github.com/percona/percona-everest-cli/pkg/cache"
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
File is not gci-ed with --skip-generated -s standard -s default -s prefix(github.com/percona/percona-everest-cli) (gci)


"github.com/percona/percona-everest-cli/pkg/cache"
"github.com/zitadel/oidc/v2/pkg/oidc"
"go.uber.org/zap"
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
File is not gci-ed with --skip-generated -s standard -s default -s prefix(github.com/percona/percona-everest-cli) (gci)

@@ -25,6 +25,9 @@ import (
"net/http"

"github.com/percona/percona-everest-backend/client"
"github.com/percona/percona-everest-cli/pkg/cache"
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
File is not gci-ed with --skip-generated -s standard -s default -s prefix(github.com/percona/percona-everest-cli) (gci)

if cred != nil {
cl := oauth2.NewClient(ctx, oauth2.StaticTokenSource(&oauth2.Token{
AccessToken: cred.AccessToken,
// TODO: do we need to refresh token?
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
pkg/everest/client/client.go:60: Line contains TODO/BUG/FIXME: "TODO: do we need to refresh token?" (godox)

}

cacheDir := path.Join(homeDir, ".everest")
if err := os.MkdirAll(cacheDir, 0700); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
File is not gofumpt-ed (gofumpt)


type (
// LoginConfig stores configuration for the versions command.
LoginConfig struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
type name will be used as login.LoginConfig by other packages, and that stutters; consider calling this Config (golint)

return nil, err
}

cacheData, err := os.ReadFile(cacheFile)
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
G304: Potential file inclusion via variable (gosec)

}

// Run runs the login command.
func (l *Login) Run(ctx context.Context) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
(*Login).Run - ctx is unused (unparam)

}

if c.Credentials == nil {
return nil, nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
return both the nil error and invalid value: use a sentinel error instead (nilnil)


token, ok := c.Credentials[issuer]
if !ok {
return nil, nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚫 [golangci] reported by reviewdog 🐶
return both the nil error and invalid value: use a sentinel error instead (nilnil)

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

Successfully merging this pull request may close these issues.

2 participants