Skip to content

Commit 8908b96

Browse files
authored
Merge branch 'main' into brett-i207/add-coder-user-edit-role-command-for-edit
2 parents 1e049b3 + a986059 commit 8908b96

34 files changed

+948
-487
lines changed

agent/agent_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,8 +1650,10 @@ func TestAgent_Lifecycle(t *testing.T) {
16501650
t.Run("ShutdownScriptOnce", func(t *testing.T) {
16511651
t.Parallel()
16521652
logger := testutil.Logger(t)
1653+
ctx := testutil.Context(t, testutil.WaitMedium)
16531654
expected := "this-is-shutdown"
16541655
derpMap, _ := tailnettest.RunDERPAndSTUN(t)
1656+
statsCh := make(chan *proto.Stats, 50)
16551657

16561658
client := agenttest.NewClient(t,
16571659
logger,
@@ -1670,7 +1672,7 @@ func TestAgent_Lifecycle(t *testing.T) {
16701672
RunOnStop: true,
16711673
}},
16721674
},
1673-
make(chan *proto.Stats, 50),
1675+
statsCh,
16741676
tailnet.NewCoordinator(logger),
16751677
)
16761678
defer client.Close()
@@ -1695,6 +1697,11 @@ func TestAgent_Lifecycle(t *testing.T) {
16951697
return len(content) > 0 // something is in the startup log file
16961698
}, testutil.WaitShort, testutil.IntervalMedium)
16971699

1700+
// In order to avoid shutting down the agent before it is fully started and triggering
1701+
// errors, we'll wait until the agent is fully up. It's a bit hokey, but among the last things the agent starts
1702+
// is the stats reporting, so getting a stats report is a good indication the agent is fully up.
1703+
_ = testutil.RequireRecvCtx(ctx, t, statsCh)
1704+
16981705
err := agent.Close()
16991706
require.NoError(t, err, "agent should be closed successfully")
17001707

cli/testdata/coder_list_--output_json.golden

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"count": 0,
6868
"available": 0,
6969
"most_recently_seen": null
70-
}
70+
},
71+
"template_version_preset_id": null
7172
},
7273
"latest_app_status": null,
7374
"outdated": false,

coderd/apidoc/docs.go

Lines changed: 13 additions & 0 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: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderdtest/coderdtest.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
421421
handler.ServeHTTP(w, r)
422422
}
423423
}))
424+
t.Logf("coderdtest server listening on %s", srv.Listener.Addr().String())
424425
srv.Config.BaseContext = func(_ net.Listener) context.Context {
425426
return ctx
426427
}
@@ -433,7 +434,12 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
433434
} else {
434435
srv.Start()
435436
}
436-
t.Cleanup(srv.Close)
437+
t.Logf("coderdtest server started on %s", srv.URL)
438+
t.Cleanup(func() {
439+
t.Logf("closing coderdtest server on %s", srv.Listener.Addr().String())
440+
srv.Close()
441+
t.Logf("closed coderdtest server on %s", srv.Listener.Addr().String())
442+
})
437443

438444
tcpAddr, ok := srv.Listener.Addr().(*net.TCPAddr)
439445
require.True(t, ok)

coderd/database/dbmem/dbmem.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9788,19 +9788,20 @@ func (q *FakeQuerier) InsertWorkspaceBuild(_ context.Context, arg database.Inser
97889788
defer q.mutex.Unlock()
97899789

97909790
workspaceBuild := database.WorkspaceBuild{
9791-
ID: arg.ID,
9792-
CreatedAt: arg.CreatedAt,
9793-
UpdatedAt: arg.UpdatedAt,
9794-
WorkspaceID: arg.WorkspaceID,
9795-
TemplateVersionID: arg.TemplateVersionID,
9796-
BuildNumber: arg.BuildNumber,
9797-
Transition: arg.Transition,
9798-
InitiatorID: arg.InitiatorID,
9799-
JobID: arg.JobID,
9800-
ProvisionerState: arg.ProvisionerState,
9801-
Deadline: arg.Deadline,
9802-
MaxDeadline: arg.MaxDeadline,
9803-
Reason: arg.Reason,
9791+
ID: arg.ID,
9792+
CreatedAt: arg.CreatedAt,
9793+
UpdatedAt: arg.UpdatedAt,
9794+
WorkspaceID: arg.WorkspaceID,
9795+
TemplateVersionID: arg.TemplateVersionID,
9796+
BuildNumber: arg.BuildNumber,
9797+
Transition: arg.Transition,
9798+
InitiatorID: arg.InitiatorID,
9799+
JobID: arg.JobID,
9800+
ProvisionerState: arg.ProvisionerState,
9801+
Deadline: arg.Deadline,
9802+
MaxDeadline: arg.MaxDeadline,
9803+
Reason: arg.Reason,
9804+
TemplateVersionPresetID: arg.TemplateVersionPresetID,
98049805
}
98059806
q.workspaceBuilds = append(q.workspaceBuilds, workspaceBuild)
98069807
return nil

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import (
2727

2828
"cdr.dev/slog"
2929

30+
"github.com/coder/quartz"
31+
3032
"github.com/coder/coder/v2/coderd/apikey"
3133
"github.com/coder/coder/v2/coderd/audit"
3234
"github.com/coder/coder/v2/coderd/database"
@@ -46,7 +48,6 @@ import (
4648
"github.com/coder/coder/v2/provisionerd/proto"
4749
"github.com/coder/coder/v2/provisionersdk"
4850
sdkproto "github.com/coder/coder/v2/provisionersdk/proto"
49-
"github.com/coder/quartz"
5051
)
5152

5253
const (
@@ -635,6 +636,7 @@ func (s *server) acquireProtoJob(ctx context.Context, job database.ProvisionerJo
635636
WorkspaceBuildId: workspaceBuild.ID.String(),
636637
WorkspaceOwnerLoginType: string(owner.LoginType),
637638
WorkspaceOwnerRbacRoles: ownerRbacRoles,
639+
IsPrebuild: input.IsPrebuild,
638640
},
639641
LogLevel: input.LogLevel,
640642
},
@@ -2460,6 +2462,7 @@ type TemplateVersionImportJob struct {
24602462
type WorkspaceProvisionJob struct {
24612463
WorkspaceBuildID uuid.UUID `json:"workspace_build_id"`
24622464
DryRun bool `json:"dry_run"`
2465+
IsPrebuild bool `json:"is_prebuild,omitempty"`
24632466
LogLevel string `json:"log_level,omitempty"`
24642467
}
24652468

0 commit comments

Comments
 (0)