-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[teleport-update] Reuse MakeURL moved to common package #51383
base: master
Are you sure you want to change the base?
Conversation
0efad1d
to
b9a36d8
Compare
b9a36d8
to
721915e
Compare
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 great! Are you going to follow-up with agent changes to move the template override to a base URL override?
@sclevine ah sure, we have to add base url env for agent as well |
@sclevine I've replaced with base url by setting it from config/flag/env, but kept in |
MakeURL moved to common function to be general for both, agent and client tools
b03dfad
to
a26978f
Compare
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 great!
return trace.Errorf("Teleport download URL must use TLS (https://)") | ||
if spec.BaseURL != "" && | ||
!strings.HasPrefix(strings.ToLower(spec.BaseURL), "https://") { | ||
return trace.Errorf("Teleport download URL must use TLS (https://): %q", spec.BaseURL) |
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.
return trace.Errorf("Teleport download URL must use TLS (https://): %q", spec.BaseURL) | |
return trace.Errorf("Teleport download base URL %s must use TLS (https://)", spec.BaseURL) |
Quotes are escaped with structured logging and don't look great
@@ -127,15 +126,15 @@ func (li *LocalInstaller) Remove(ctx context.Context, rev Revision) error { | |||
// Install a Teleport version directory in InstallDir. | |||
// This function is idempotent. | |||
// See Installer interface for additional specs. | |||
func (li *LocalInstaller) Install(ctx context.Context, rev Revision, template string) (err error) { | |||
func (li *LocalInstaller) Install(ctx context.Context, rev Revision, template string, baseURL string) (err error) { |
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.
Can we remove the template
param and move to it to a Template
field on LocalInstaller
? It could be set to autoupdate.DefaultCDNURITemplate
in NewLocalUpdater
, and directly set in tests.
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.
Make sense, I kept this one only for test in such case
@@ -185,7 +184,7 @@ type Updater struct { | |||
type Installer interface { | |||
// Install the Teleport agent at revision from the download template. | |||
// Install must be idempotent. | |||
Install(ctx context.Context, rev Revision, template string) error | |||
Install(ctx context.Context, rev Revision, template string, baseURL string) error |
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.
Install(ctx context.Context, rev Revision, template string, baseURL string) error | |
Install(ctx context.Context, rev Revision, baseURL string) error |
Refactoring after moving
MakeURL
andRevision
to common packageDepends on: #51210