Skip to content

Commit 4a0888c

Browse files
mtojekmafredri
authored andcommitted
More code
1 parent 5e8b150 commit 4a0888c

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

coderd/provisionerdserver/provisionerdserver_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ func TestInsertWorkspaceResource(t *testing.T) {
957957
Apps: []*sdkproto.App{{
958958
Slug: "a",
959959
}},
960+
ShutdownScript: "shutdown",
960961
}},
961962
})
962963
require.NoError(t, err)
@@ -971,6 +972,7 @@ func TestInsertWorkspaceResource(t *testing.T) {
971972
require.Equal(t, "amd64", agent.Architecture)
972973
require.Equal(t, "linux", agent.OperatingSystem)
973974
require.Equal(t, "value", agent.StartupScript.String)
975+
require.Equal(t, "shutdown", agent.ShutdownScript.String)
974976
want, err := json.Marshal(map[string]string{
975977
"something": "test",
976978
})

coderd/telemetry/telemetry.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ func ConvertWorkspaceAgent(agent database.WorkspaceAgent) WorkspaceAgent {
550550
StartupScript: agent.StartupScript.Valid,
551551
Directory: agent.Directory != "",
552552
ConnectionTimeoutSeconds: agent.ConnectionTimeoutSeconds,
553+
ShutdownScript: agent.ShutdownScript.Valid,
553554
}
554555
if agent.FirstConnectedAt.Valid {
555556
snapAgent.FirstConnectedAt = &agent.FirstConnectedAt.Time
@@ -750,6 +751,7 @@ type WorkspaceAgent struct {
750751
LastConnectedAt *time.Time `json:"last_connected_at"`
751752
DisconnectedAt *time.Time `json:"disconnected_at"`
752753
ConnectionTimeoutSeconds int32 `json:"connection_timeout_seconds"`
754+
ShutdownScript bool `json:"shutdown_script"`
753755
}
754756

755757
type WorkspaceApp struct {

coderd/workspaceagents.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,7 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
823823
LifecycleState: codersdk.WorkspaceAgentLifecycle(dbAgent.LifecycleState),
824824
LoginBeforeReady: dbAgent.LoginBeforeReady,
825825
StartupScriptTimeoutSeconds: dbAgent.StartupScriptTimeoutSeconds,
826+
ShutdownScript: dbAgent.ShutdownScript.String,
826827
}
827828
node := coordinator.Node(dbAgent.ID)
828829
if node != nil {

0 commit comments

Comments
 (0)