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

fix: return provisioners in desc order and add limit to cli#16720

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

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletioncli/provisioners.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,6 +39,7 @@ func (r *RootCmd) provisionerList() *serpent.Command {
cliui.TableFormat([]provisionerDaemonRow{}, []string{"name", "organization", "status", "key name", "created at", "last seen at", "version", "tags"}),
cliui.JSONFormat(),
)
limit int64
)

cmd := &serpent.Command{
Expand All@@ -57,7 +58,9 @@ func (r *RootCmd) provisionerList() *serpent.Command {
return xerrors.Errorf("current organization: %w", err)
}

daemons, err := client.OrganizationProvisionerDaemons(ctx, org.ID, nil)
daemons, err := client.OrganizationProvisionerDaemons(ctx, org.ID, &codersdk.OrganizationProvisionerDaemonsOptions{
Limit: int(limit),
})
if err != nil {
return xerrors.Errorf("list provisioner daemons: %w", err)
}
Expand DownExpand Up@@ -86,6 +89,17 @@ func (r *RootCmd) provisionerList() *serpent.Command {
},
}

cmd.Options = append(cmd.Options, []serpent.Option{
{
Flag: "limit",
FlagShorthand: "l",
Env: "CODER_PROVISIONER_LIST_LIMIT",
Description: "Limit the number of provisioners returned.",
Default: "50",
Value: serpent.Int64Of(&limit),
},
}...)

orgContext.AttachOptions(cmd)
formatter.AttachOptions(&cmd.Options)

Expand Down
3 changes: 3 additions & 0 deletionscli/testdata/coder_provisioner_list_--help.golden
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,9 @@ OPTIONS:
-c, --column [id|organization id|created at|last seen at|name|version|api version|tags|key name|status|current job id|current job status|current job template name|current job template icon|current job template display name|previous job id|previous job status|previous job template name|previous job template icon|previous job template display name|organization] (default: name,organization,status,key name,created at,last seen at,version,tags)
Columns to display in table output.

-l, --limit int, $CODER_PROVISIONER_LIST_LIMIT (default: 50)
Limit the number of provisioners returned.

-o, --output table|json (default: table)
Output format.

Expand Down
2 changes: 1 addition & 1 deletioncoderd/database/dbmem/dbmem.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4073,7 +4073,7 @@ func (q *FakeQuerier) GetProvisionerDaemonsWithStatusByOrganization(ctx context.
}

slices.SortFunc(rows, func(a, b database.GetProvisionerDaemonsWithStatusByOrganizationRow) int {
returna.ProvisionerDaemon.CreatedAt.Compare(b.ProvisionerDaemon.CreatedAt)
returnb.ProvisionerDaemon.CreatedAt.Compare(a.ProvisionerDaemon.CreatedAt)
})

if arg.Limit.Valid && arg.Limit.Int32 > 0 && len(rows) > int(arg.Limit.Int32) {
Expand Down
2 changes: 1 addition & 1 deletioncoderd/database/queries.sql.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletioncoderd/database/queries/provisionerdaemons.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,7 +111,7 @@ WHERE
AND (COALESCE(array_length(@ids::uuid[], 1), 0) = 0 OR pd.id = ANY(@ids::uuid[]))
AND (@tags::tagset = 'null'::tagset OR provisioner_tagset_contains(pd.tags::tagset, @tags::tagset))
ORDER BY
pd.created_atASC
pd.created_atDESC
LIMIT
sqlc.narg('limit')::int;

Expand Down
4 changes: 2 additions & 2 deletionscoderd/provisionerdaemons_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -159,8 +159,8 @@ func TestProvisionerDaemons(t *testing.T) {
})
require.NoError(t, err)
require.Len(t, daemons, 2)
require.Equal(t, pd1.ID, daemons[0].ID)
require.Equal(t, pd2.ID, daemons[1].ID)
require.Equal(t, pd1.ID, daemons[1].ID)
require.Equal(t, pd2.ID, daemons[0].ID)
})

t.Run("Tags", func(t *testing.T) {
Expand Down
10 changes: 10 additions & 0 deletionsdocs/reference/cli/provisioner_list.md
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,9 @@ OPTIONS:
-c, --column [id|organization id|created at|last seen at|name|version|api version|tags|key name|status|current job id|current job status|current job template name|current job template icon|current job template display name|previous job id|previous job status|previous job template name|previous job template icon|previous job template display name|organization] (default: name,organization,status,key name,created at,last seen at,version,tags)
Columns to display in table output.

-l, --limit int, $CODER_PROVISIONER_LIST_LIMIT (default: 50)
Limit the number of provisioners returned.

-o, --output table|json (default: table)
Output format.

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp