-
Notifications
You must be signed in to change notification settings - Fork 77
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
feature(cli): Adding CLI cloud login and auth logic #3100
Conversation
@@ -271,6 +271,9 @@ func setupResources() { | |||
extraHeaders := http.Header{} | |||
extraHeaders.Set("x-client-id", analytics.ClientID()) | |||
extraHeaders.Set("x-source", "cli") | |||
extraHeaders.Set("x-organization-id", cliConfig.OrganizationID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are attaching the new headers as part of the request
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we are always going to send this headers, right? even for OSS?
cliConfig.Token = token | ||
cliConfig.Jwt = jwt | ||
serverPath := "" | ||
cliConfig.ServerPath = &serverPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to remove the /api
server prefix
@@ -47,7 +47,7 @@ func NewHTTPClient(baseURL string, extraHeaders http.Header) *HTTPClient { | |||
} | |||
|
|||
func (c HTTPClient) url(resourceName string, extra ...string) *url.URL { | |||
urlStr := c.baseURL + path.Join("/api", resourceName, strings.Join(extra, "/")) | |||
urlStr := c.baseURL + path.Join("/", resourceName, strings.Join(extra, "/")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prefix will be part of the server path now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, added a couple of comments
var loginCmd = &cobra.Command{ | ||
GroupID: cmdGroupCloud.ID, | ||
Use: "login", | ||
Short: "Tracetst Cloud Login", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short: "Tracetst Cloud Login", | |
Short: "Tracetest Cloud Login", |
GroupID: cmdGroupCloud.ID, | ||
Use: "login", | ||
Short: "Tracetst Cloud Login", | ||
Long: "Initializes the Tracetst Cloud Login process", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Long: "Initializes the Tracetst Cloud Login process", | |
Long: "Initializes the Tracetest Cloud Login process", |
@@ -271,6 +271,9 @@ func setupResources() { | |||
extraHeaders := http.Header{} | |||
extraHeaders.Set("x-client-id", analytics.ClientID()) | |||
extraHeaders.Set("x-source", "cli") | |||
extraHeaders.Set("x-organization-id", cliConfig.OrganizationID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we are always going to send this headers, right? even for OSS?
* feature(cli): Adding CLI cloud login and auth logic (#3100) * feature(cli): adding CLI cloud login and auth logic * feature(cli): adding CLI cloud login and auth logic * feat(cloud): adding support for cloud resources (#3101) * feature(cli): adding CLI cloud login and auth logic * feature(cli): adding CLI cloud login and auth logic * feat(cloud): adding support for cloud resources * feat(cloud): adding select command for cloud resources * feat(cloud): Tracetest configure improvements (#3102) * feature(cli): adding CLI cloud login and auth logic * feature(cli): adding CLI cloud login and auth logic * feat(cloud): adding support for cloud resources * feat(cloud): adding select command for cloud resources * fixing CLI e2e * Fixing missing prefix and CLI e2e tests * removing deprecation tests for environments * downgrading the goreleaser version * fixing CLI e2e * fixing status code * fixing FE port * fixing FE port * Implementing tracetest configure command * cleanup * adding missing select cmd * adding path validation for configure * re adding missing tests * feat(cli): adding `tracetest start` command (#3114) * feat(cli): adding start command * feat(cli): adding start command * feat(cli): cleanup and dynamic endpoint support (#3121)
This PR adds the base logic to support CLI cloud login and authentication
Changes
tracetest login
commandChecklist