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

[teleport-update] Reuse MakeURL moved to common package #51383

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vapopov
Copy link
Contributor

@vapopov vapopov commented Jan 22, 2025

Refactoring after moving MakeURL and Revision to common package

Depends on: #51210

@vapopov vapopov requested review from sclevine and hugoShaka January 22, 2025 22:50
@github-actions github-actions bot requested a review from camscale January 22, 2025 22:50
@github-actions github-actions bot requested a review from zmb3 January 22, 2025 22:50
@vapopov vapopov force-pushed the vapopov/client-tools-update-uri-template-agent branch 3 times, most recently from 0efad1d to b9a36d8 Compare January 22, 2025 22:59
@vapopov vapopov added the no-changelog Indicates that a PR does not require a changelog entry label Jan 22, 2025
@vapopov vapopov force-pushed the vapopov/client-tools-update-uri-template-agent branch from b9a36d8 to 721915e Compare January 23, 2025 11:30
@vapopov vapopov requested a review from sclevine January 23, 2025 17:37
Copy link
Member

@sclevine sclevine left a 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?

@vapopov
Copy link
Contributor Author

vapopov commented Jan 23, 2025

@sclevine ah sure, we have to add base url env for agent as well

@vapopov
Copy link
Contributor Author

vapopov commented Jan 24, 2025

@sclevine I've replaced with base url by setting it from config/flag/env, but kept in Install interface of the updater logic

Base automatically changed from vapopov/client-tools-update-uri-template to master January 24, 2025 21:47
@vapopov vapopov force-pushed the vapopov/client-tools-update-uri-template-agent branch from b03dfad to a26978f Compare January 24, 2025 22:45
Copy link
Member

@sclevine sclevine left a 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)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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) {
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Install(ctx context.Context, rev Revision, template string, baseURL string) error
Install(ctx context.Context, rev Revision, baseURL string) error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry size/sm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants