Skip to content

Commit 5e41bcb

Browse files
committed
Add shutdown script timeout
1 parent 82159e4 commit 5e41bcb

21 files changed

+496
-419
lines changed

coderd/apidoc/docs.go

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

coderd/database/dump.sql

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
ALTER TABLE workspace_agents DROP COLUMN shutdown_script;
2+
3+
ALTER TABLE workspace_agents DROP COLUMN shutdown_script_timeout_seconds;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
ALTER TABLE workspace_agents ADD COLUMN shutdown_script varchar(65534);
22

33
COMMENT ON COLUMN workspace_agents.shutdown_script IS 'Script that is executed before the agent is stopped.';
4+
5+
-- Disable shutdown script timeouts by default.
6+
ALTER TABLE workspace_agents ADD COLUMN shutdown_script_timeout_seconds int4 NOT NULL DEFAULT 0;
7+
8+
COMMENT ON COLUMN workspace_agents.shutdown_script_timeout_seconds IS 'The number of seconds to wait for the shutdown script to complete. If the script does not complete within this time, the agent lifecycle will be marked as shutdown_timeout.';

coderd/database/models.go

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

coderd/database/queries.sql.go

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

coderd/database/queries/workspaceagents.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ INSERT INTO
5959
motd_file,
6060
login_before_ready,
6161
startup_script_timeout_seconds,
62-
shutdown_script
62+
shutdown_script,
63+
shutdown_script_timeout_seconds
6364
)
6465
VALUES
65-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20) RETURNING *;
66+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) RETURNING *;
6667

6768
-- name: UpdateWorkspaceAgentConnectionByID :exec
6869
UPDATE

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
11481148
String: prAgent.ShutdownScript,
11491149
Valid: prAgent.ShutdownScript != "",
11501150
},
1151+
ShutdownScriptTimeoutSeconds: prAgent.GetShutdownScriptTimeoutSeconds(),
11511152
})
11521153
if err != nil {
11531154
return xerrors.Errorf("insert agent: %w", err)

0 commit comments

Comments
 (0)