Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a46fcfa

Browse files
committed
Merge branch 'main' into colin/update-tailscale
2 parents afd343e + f6effdb commit a46fcfa

File tree

83 files changed

+2947
-568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2947
-568
lines changed

agent/agent.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,11 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri
814814

815815
cmd := exec.CommandContext(ctx, shell, args...)
816816
cmd.Dir = metadata.Directory
817-
if cmd.Dir == "" {
817+
818+
// If the metadata directory doesn't exist, we run the command
819+
// in the users home directory.
820+
_, err = os.Stat(cmd.Dir)
821+
if cmd.Dir == "" || err != nil {
818822
// Default to user home if a directory is not set.
819823
homedir, err := userHomeDir()
820824
if err != nil {

cli/cliui/parameter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,5 @@ func validateRichPrompt(value string, p codersdk.TemplateVersionParameter) error
114114
return codersdk.ValidateWorkspaceBuildParameter(p, codersdk.WorkspaceBuildParameter{
115115
Name: p.Name,
116116
Value: value,
117-
})
117+
}, nil)
118118
}

cli/create_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func TestCreate(t *testing.T) {
8787
_ = coderdtest.CreateTemplate(t, client, user.OrganizationID, version.ID)
8888
cmd, root := clitest.New(t, "create", "my-workspace", "-y")
8989

90-
member := coderdtest.CreateAnotherUser(t, client, user.OrganizationID)
90+
member, _ := coderdtest.CreateAnotherUser(t, client, user.OrganizationID)
9191
clitest.SetupConfig(t, member, root)
9292
cmdCtx, done := context.WithTimeout(context.Background(), testutil.WaitLong)
9393
go func() {

cli/delete_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestDelete(t *testing.T) {
7777
adminClient := coderdtest.New(t, &coderdtest.Options{IncludeProvisionerDaemon: true})
7878
adminUser := coderdtest.CreateFirstUser(t, adminClient)
7979
orgID := adminUser.OrganizationID
80-
client := coderdtest.CreateAnotherUser(t, adminClient, orgID)
80+
client, _ := coderdtest.CreateAnotherUser(t, adminClient, orgID)
8181
user, err := client.User(context.Background(), codersdk.Me)
8282
require.NoError(t, err)
8383

cli/userlist_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,9 @@ func TestUserShow(t *testing.T) {
8787

8888
t.Run("Table", func(t *testing.T) {
8989
t.Parallel()
90-
ctx := context.Background()
9190
client := coderdtest.New(t, nil)
9291
admin := coderdtest.CreateFirstUser(t, client)
93-
other := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
94-
otherUser, err := other.User(ctx, codersdk.Me)
95-
require.NoError(t, err, "fetch other user")
92+
_, otherUser := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
9693
cmd, root := clitest.New(t, "users", "show", otherUser.Username)
9794
clitest.SetupConfig(t, client, root)
9895
doneChan := make(chan struct{})
@@ -114,7 +111,7 @@ func TestUserShow(t *testing.T) {
114111
ctx := context.Background()
115112
client := coderdtest.New(t, nil)
116113
admin := coderdtest.CreateFirstUser(t, client)
117-
other := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
114+
other, _ := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
118115
otherUser, err := other.User(ctx, codersdk.Me)
119116
require.NoError(t, err, "fetch other user")
120117
cmd, root := clitest.New(t, "users", "show", otherUser.Username, "-o", "json")

cli/userstatus_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestUserStatus(t *testing.T) {
1717
t.Parallel()
1818
client := coderdtest.New(t, nil)
1919
admin := coderdtest.CreateFirstUser(t, client)
20-
other := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
20+
other, _ := coderdtest.CreateAnotherUser(t, client, admin.OrganizationID)
2121
otherUser, err := other.User(context.Background(), codersdk.Me)
2222
require.NoError(t, err, "fetch user")
2323

coderd/apidoc/docs.go

Lines changed: 90 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 78 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apikey_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func TestSessionExpiry(t *testing.T) {
137137
// this test it works because we don't copy the value (and we use pointers).
138138
dc.SessionDuration.Value = time.Second
139139

140-
userClient := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID)
140+
userClient, _ := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID)
141141

142142
// Find the session cookie, and ensure it has the correct expiry.
143143
token := userClient.SessionToken()

coderd/authorize_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ func TestCheckPermissions(t *testing.T) {
2424
})
2525
// Create adminClient, member, and org adminClient
2626
adminUser := coderdtest.CreateFirstUser(t, adminClient)
27-
memberClient := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID)
27+
memberClient, _ := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID)
2828
memberUser, err := memberClient.User(ctx, codersdk.Me)
2929
require.NoError(t, err)
30-
orgAdminClient := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID, rbac.RoleOrgAdmin(adminUser.OrganizationID))
30+
orgAdminClient, _ := coderdtest.CreateAnotherUser(t, adminClient, adminUser.OrganizationID, rbac.RoleOrgAdmin(adminUser.OrganizationID))
3131
orgAdminUser, err := orgAdminClient.User(ctx, codersdk.Me)
3232
require.NoError(t, err)
3333

coderd/coderdtest/coderdtest.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,7 @@ func CreateFirstUser(t *testing.T, client *codersdk.Client) codersdk.CreateFirst
447447
}
448448

449449
// CreateAnotherUser creates and authenticates a new user.
450-
func CreateAnotherUser(t *testing.T, client *codersdk.Client, organizationID uuid.UUID, roles ...string) *codersdk.Client {
451-
userClient, _ := createAnotherUserRetry(t, client, organizationID, 5, roles...)
452-
return userClient
453-
}
454-
455-
func CreateAnotherUserWithUser(t *testing.T, client *codersdk.Client, organizationID uuid.UUID, roles ...string) (*codersdk.Client, codersdk.User) {
450+
func CreateAnotherUser(t *testing.T, client *codersdk.Client, organizationID uuid.UUID, roles ...string) (*codersdk.Client, codersdk.User) {
456451
return createAnotherUserRetry(t, client, organizationID, 5, roles...)
457452
}
458453

coderd/database/dbfake/databasefake.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,18 +2573,19 @@ func (q *fakeQuerier) InsertTemplateVersionParameter(_ context.Context, arg data
25732573

25742574
//nolint:gosimple
25752575
param := database.TemplateVersionParameter{
2576-
TemplateVersionID: arg.TemplateVersionID,
2577-
Name: arg.Name,
2578-
Description: arg.Description,
2579-
Type: arg.Type,
2580-
Mutable: arg.Mutable,
2581-
DefaultValue: arg.DefaultValue,
2582-
Icon: arg.Icon,
2583-
Options: arg.Options,
2584-
ValidationError: arg.ValidationError,
2585-
ValidationRegex: arg.ValidationRegex,
2586-
ValidationMin: arg.ValidationMin,
2587-
ValidationMax: arg.ValidationMax,
2576+
TemplateVersionID: arg.TemplateVersionID,
2577+
Name: arg.Name,
2578+
Description: arg.Description,
2579+
Type: arg.Type,
2580+
Mutable: arg.Mutable,
2581+
DefaultValue: arg.DefaultValue,
2582+
Icon: arg.Icon,
2583+
Options: arg.Options,
2584+
ValidationError: arg.ValidationError,
2585+
ValidationRegex: arg.ValidationRegex,
2586+
ValidationMin: arg.ValidationMin,
2587+
ValidationMax: arg.ValidationMax,
2588+
ValidationMonotonic: arg.ValidationMonotonic,
25882589
}
25892590
q.templateVersionParameters = append(q.templateVersionParameters, param)
25902591
return param, nil

coderd/database/dump.sql

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE template_version_parameters DROP CONSTRAINT validation_monotonic_order;
2+
3+
ALTER TABLE template_version_parameters DROP COLUMN validation_monotonic;

0 commit comments

Comments
 (0)