Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add--version flag tocoder templates pull, default to active version#10153

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

coadler
Copy link
Contributor

Fixes#9837

@coadler
Copy link
ContributorAuthor

Current dependencies on/for this PR:

This comment was auto-generated byGraphite.

Comment on lines +52 to 73
var latestVersion codersdk.TemplateVersion
{
// Determine the latest template version and compare with the
// active version. If they aren't the same, warn the user.
versions, err := client.TemplateVersionsByTemplate(ctx, codersdk.TemplateVersionsByTemplateRequest{
TemplateID: template.ID,
})
if err != nil {
return xerrors.Errorf("template versions by template: %w", err)
}

if len(versions) == 0 {
return xerrors.Errorf("no template versions for template %q", templateName)
}

// Sort the slice from newest to oldest template.
sort.SliceStable(versions, func(i, j int) bool {
return versions[i].CreatedAt.After(versions[j].CreatedAt)
})

if len(versions) == 0 {
return xerrors.Errorf("no template versions for template %q", templateName)
latestVersion = versions[0]
}
Copy link
Member

Choose a reason for hiding this comment

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

You should move this into the switch when you pick latest

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I need to know the latest version for the warning when the version isn't specified.

deansheather reacted with thumbs up emoji
@coadlercoadler merged commitc11f241 intomainOct 10, 2023
@coadlercoadler deleted the colin/featadd--versionflagtocodertemplatespulldefaulttoactiveversion branchOctober 10, 2023 15:20
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 10, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@deansheatherdeansheatherdeansheather approved these changes

Assignees

@coadlercoadler

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

coder templates pull: should pull the promoted version, not the latest
2 participants
@coadler@deansheather

[8]ページ先頭

©2009-2025 Movatter.jp