-
Notifications
You must be signed in to change notification settings - Fork 0
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
Migrate configuration #13
Conversation
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.
https://www.jenkins.io/doc/book/system-administration/authenticating-scripted-clients/
I think the password and token are basically interchangeable
func WithSetBasicAuthHeader(username, password string) uhttp.RequestOption {
return uhttp.WithHeader("Authorization", "Basic "+basicAuth(username, password))
}
func WithSetTokenAuthHeader(username, token string) uhttp.RequestOption {
return uhttp.WithHeader("Authorization", "Basic "+basicAuth(username, token))
}
Also, make sure to update the help text in the README
l := ctxzap.Extract(ctx) | ||
jenkinsClient := client.NewClient() | ||
if cfg.JenkinsToken != "" { | ||
jenkinsClient.WithUser(cfg.JenkinsUsername).WithBearerToken(cfg.JenkinsToken) | ||
if v.GetString("token") != "" { |
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.
l := ctxzap.Extract(ctx)
err := field.Validate(Configuration, v)
if err != nil {
return nil, err
}
jenkinsClient := client.NewClient().
WithUser(v.GetString("username")).
WithPassword(v.GetString("password")).
WithToken(v.GetString("token"))
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.
I mean, is that even possible without causing API errors? 😆
the client API for Jenkins has some expectations, so we cannot re-use variables to set that piece of auth information: jenkinsClient.WithUser("random-username").WithBearerToken("magic-token")
jenkinsClient.WithUser("random-username").WithPassword("secretpassword") |
Pull Request
To help us get this pull request reviewed and merged quickly, please be sure to include the following items:
PR Type
What kind of change does this PR introduce?
Backward Compatibility
Is this change backward compatible with the most recently released version? Does it introduce changes which might change the user experience in any way? Does it alter the Connector in any way?
Useful links:
Issue Linking
What's new?