mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
chore: Invert delay_login_until_ready
, now login_before_ready
(#5893)
This commit is contained in:
committed by
GitHub
parent
8a5760a2fe
commit
981cac5e28
8
coderd/apidoc/docs.go
generated
8
coderd/apidoc/docs.go
generated
@ -7770,10 +7770,6 @@ const docTemplate = `{
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"delay_login_until_ready": {
|
||||
"description": "DelayLoginUntilReady if true, the agent will delay logins until it is ready (e.g. executing startup script has ended).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"directory": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -7812,6 +7808,10 @@ const docTemplate = `{
|
||||
"lifecycle_state": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAgentLifecycle"
|
||||
},
|
||||
"login_before_ready": {
|
||||
"description": "LoginBeforeReady if true, the agent will delay logins until it is ready (e.g. executing startup script has ended).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
|
8
coderd/apidoc/swagger.json
generated
8
coderd/apidoc/swagger.json
generated
@ -6985,10 +6985,6 @@
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"delay_login_until_ready": {
|
||||
"description": "DelayLoginUntilReady if true, the agent will delay logins until it is ready (e.g. executing startup script has ended).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"directory": {
|
||||
"type": "string"
|
||||
},
|
||||
@ -7027,6 +7023,10 @@
|
||||
"lifecycle_state": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAgentLifecycle"
|
||||
},
|
||||
"login_before_ready": {
|
||||
"description": "LoginBeforeReady if true, the agent will delay logins until it is ready (e.g. executing startup script has ended).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
|
4
coderd/database/dump.sql
generated
4
coderd/database/dump.sql
generated
@ -461,7 +461,7 @@ CREATE TABLE workspace_agents (
|
||||
troubleshooting_url text DEFAULT ''::text NOT NULL,
|
||||
motd_file text DEFAULT ''::text NOT NULL,
|
||||
lifecycle_state workspace_agent_lifecycle_state DEFAULT 'created'::workspace_agent_lifecycle_state NOT NULL,
|
||||
delay_login_until_ready boolean DEFAULT false NOT NULL,
|
||||
login_before_ready boolean DEFAULT true NOT NULL,
|
||||
startup_script_timeout_seconds integer DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
@ -475,7 +475,7 @@ COMMENT ON COLUMN workspace_agents.motd_file IS 'Path to file inside workspace c
|
||||
|
||||
COMMENT ON COLUMN workspace_agents.lifecycle_state IS 'The current lifecycle state reported by the workspace agent.';
|
||||
|
||||
COMMENT ON COLUMN workspace_agents.delay_login_until_ready IS 'If true, the agent will delay logins until it is ready (e.g. executing startup script has ended).';
|
||||
COMMENT ON COLUMN workspace_agents.login_before_ready IS 'If true, the agent will not prevent login before it is ready (e.g. startup script is still executing).';
|
||||
|
||||
COMMENT ON COLUMN workspace_agents.startup_script_timeout_seconds IS 'The number of seconds to wait for the startup script to complete. If the script does not complete within this time, the agent lifecycle will be marked as start_timeout.';
|
||||
|
||||
|
@ -0,0 +1,8 @@
|
||||
BEGIN;
|
||||
ALTER TABLE workspace_agents RENAME COLUMN login_before_ready TO delay_login_until_ready;
|
||||
ALTER TABLE workspace_agents ALTER COLUMN delay_login_until_ready SET DEFAULT false;
|
||||
|
||||
UPDATE workspace_agents SET delay_login_until_ready = NOT delay_login_until_ready;
|
||||
|
||||
COMMENT ON COLUMN workspace_agents.delay_login_until_ready IS 'If true, the agent will delay logins until it is ready (e.g. executing startup script has ended).';
|
||||
COMMIT;
|
@ -0,0 +1,8 @@
|
||||
BEGIN;
|
||||
ALTER TABLE workspace_agents RENAME COLUMN delay_login_until_ready TO login_before_ready;
|
||||
ALTER TABLE workspace_agents ALTER COLUMN login_before_ready SET DEFAULT true;
|
||||
|
||||
UPDATE workspace_agents SET login_before_ready = NOT login_before_ready;
|
||||
|
||||
COMMENT ON COLUMN workspace_agents.login_before_ready IS 'If true, the agent will not prevent login before it is ready (e.g. startup script is still executing).';
|
||||
COMMIT;
|
@ -1519,8 +1519,8 @@ type WorkspaceAgent struct {
|
||||
MOTDFile string `db:"motd_file" json:"motd_file"`
|
||||
// The current lifecycle state reported by the workspace agent.
|
||||
LifecycleState WorkspaceAgentLifecycleState `db:"lifecycle_state" json:"lifecycle_state"`
|
||||
// If true, the agent will delay logins until it is ready (e.g. executing startup script has ended).
|
||||
DelayLoginUntilReady bool `db:"delay_login_until_ready" json:"delay_login_until_ready"`
|
||||
// If true, the agent will not prevent login before it is ready (e.g. startup script is still executing).
|
||||
LoginBeforeReady bool `db:"login_before_ready" json:"login_before_ready"`
|
||||
// The number of seconds to wait for the startup script to complete. If the script does not complete within this time, the agent lifecycle will be marked as start_timeout.
|
||||
StartupScriptTimeoutSeconds int32 `db:"startup_script_timeout_seconds" json:"startup_script_timeout_seconds"`
|
||||
}
|
||||
|
@ -4840,7 +4840,7 @@ func (q *sqlQuerier) UpdateUserStatus(ctx context.Context, arg UpdateUserStatusP
|
||||
|
||||
const getWorkspaceAgentByAuthToken = `-- name: GetWorkspaceAgentByAuthToken :one
|
||||
SELECT
|
||||
id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, delay_login_until_ready, startup_script_timeout_seconds
|
||||
id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, login_before_ready, startup_script_timeout_seconds
|
||||
FROM
|
||||
workspace_agents
|
||||
WHERE
|
||||
@ -4876,7 +4876,7 @@ func (q *sqlQuerier) GetWorkspaceAgentByAuthToken(ctx context.Context, authToken
|
||||
&i.TroubleshootingURL,
|
||||
&i.MOTDFile,
|
||||
&i.LifecycleState,
|
||||
&i.DelayLoginUntilReady,
|
||||
&i.LoginBeforeReady,
|
||||
&i.StartupScriptTimeoutSeconds,
|
||||
)
|
||||
return i, err
|
||||
@ -4884,7 +4884,7 @@ func (q *sqlQuerier) GetWorkspaceAgentByAuthToken(ctx context.Context, authToken
|
||||
|
||||
const getWorkspaceAgentByID = `-- name: GetWorkspaceAgentByID :one
|
||||
SELECT
|
||||
id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, delay_login_until_ready, startup_script_timeout_seconds
|
||||
id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, login_before_ready, startup_script_timeout_seconds
|
||||
FROM
|
||||
workspace_agents
|
||||
WHERE
|
||||
@ -4918,7 +4918,7 @@ func (q *sqlQuerier) GetWorkspaceAgentByID(ctx context.Context, id uuid.UUID) (W
|
||||
&i.TroubleshootingURL,
|
||||
&i.MOTDFile,
|
||||
&i.LifecycleState,
|
||||
&i.DelayLoginUntilReady,
|
||||
&i.LoginBeforeReady,
|
||||
&i.StartupScriptTimeoutSeconds,
|
||||
)
|
||||
return i, err
|
||||
@ -4926,7 +4926,7 @@ func (q *sqlQuerier) GetWorkspaceAgentByID(ctx context.Context, id uuid.UUID) (W
|
||||
|
||||
const getWorkspaceAgentByInstanceID = `-- name: GetWorkspaceAgentByInstanceID :one
|
||||
SELECT
|
||||
id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, delay_login_until_ready, startup_script_timeout_seconds
|
||||
id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, login_before_ready, startup_script_timeout_seconds
|
||||
FROM
|
||||
workspace_agents
|
||||
WHERE
|
||||
@ -4962,7 +4962,7 @@ func (q *sqlQuerier) GetWorkspaceAgentByInstanceID(ctx context.Context, authInst
|
||||
&i.TroubleshootingURL,
|
||||
&i.MOTDFile,
|
||||
&i.LifecycleState,
|
||||
&i.DelayLoginUntilReady,
|
||||
&i.LoginBeforeReady,
|
||||
&i.StartupScriptTimeoutSeconds,
|
||||
)
|
||||
return i, err
|
||||
@ -4970,7 +4970,7 @@ func (q *sqlQuerier) GetWorkspaceAgentByInstanceID(ctx context.Context, authInst
|
||||
|
||||
const getWorkspaceAgentsByResourceIDs = `-- name: GetWorkspaceAgentsByResourceIDs :many
|
||||
SELECT
|
||||
id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, delay_login_until_ready, startup_script_timeout_seconds
|
||||
id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, login_before_ready, startup_script_timeout_seconds
|
||||
FROM
|
||||
workspace_agents
|
||||
WHERE
|
||||
@ -5010,7 +5010,7 @@ func (q *sqlQuerier) GetWorkspaceAgentsByResourceIDs(ctx context.Context, ids []
|
||||
&i.TroubleshootingURL,
|
||||
&i.MOTDFile,
|
||||
&i.LifecycleState,
|
||||
&i.DelayLoginUntilReady,
|
||||
&i.LoginBeforeReady,
|
||||
&i.StartupScriptTimeoutSeconds,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
@ -5027,7 +5027,7 @@ func (q *sqlQuerier) GetWorkspaceAgentsByResourceIDs(ctx context.Context, ids []
|
||||
}
|
||||
|
||||
const getWorkspaceAgentsCreatedAfter = `-- name: GetWorkspaceAgentsCreatedAfter :many
|
||||
SELECT id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, delay_login_until_ready, startup_script_timeout_seconds FROM workspace_agents WHERE created_at > $1
|
||||
SELECT id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, login_before_ready, startup_script_timeout_seconds FROM workspace_agents WHERE created_at > $1
|
||||
`
|
||||
|
||||
func (q *sqlQuerier) GetWorkspaceAgentsCreatedAfter(ctx context.Context, createdAt time.Time) ([]WorkspaceAgent, error) {
|
||||
@ -5063,7 +5063,7 @@ func (q *sqlQuerier) GetWorkspaceAgentsCreatedAfter(ctx context.Context, created
|
||||
&i.TroubleshootingURL,
|
||||
&i.MOTDFile,
|
||||
&i.LifecycleState,
|
||||
&i.DelayLoginUntilReady,
|
||||
&i.LoginBeforeReady,
|
||||
&i.StartupScriptTimeoutSeconds,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
@ -5099,11 +5099,11 @@ INSERT INTO
|
||||
connection_timeout_seconds,
|
||||
troubleshooting_url,
|
||||
motd_file,
|
||||
delay_login_until_ready,
|
||||
login_before_ready,
|
||||
startup_script_timeout_seconds
|
||||
)
|
||||
VALUES
|
||||
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19) RETURNING id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, delay_login_until_ready, startup_script_timeout_seconds
|
||||
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19) RETURNING id, created_at, updated_at, name, first_connected_at, last_connected_at, disconnected_at, resource_id, auth_token, auth_instance_id, architecture, environment_variables, operating_system, startup_script, instance_metadata, resource_metadata, directory, version, last_connected_replica_id, connection_timeout_seconds, troubleshooting_url, motd_file, lifecycle_state, login_before_ready, startup_script_timeout_seconds
|
||||
`
|
||||
|
||||
type InsertWorkspaceAgentParams struct {
|
||||
@ -5124,7 +5124,7 @@ type InsertWorkspaceAgentParams struct {
|
||||
ConnectionTimeoutSeconds int32 `db:"connection_timeout_seconds" json:"connection_timeout_seconds"`
|
||||
TroubleshootingURL string `db:"troubleshooting_url" json:"troubleshooting_url"`
|
||||
MOTDFile string `db:"motd_file" json:"motd_file"`
|
||||
DelayLoginUntilReady bool `db:"delay_login_until_ready" json:"delay_login_until_ready"`
|
||||
LoginBeforeReady bool `db:"login_before_ready" json:"login_before_ready"`
|
||||
StartupScriptTimeoutSeconds int32 `db:"startup_script_timeout_seconds" json:"startup_script_timeout_seconds"`
|
||||
}
|
||||
|
||||
@ -5147,7 +5147,7 @@ func (q *sqlQuerier) InsertWorkspaceAgent(ctx context.Context, arg InsertWorkspa
|
||||
arg.ConnectionTimeoutSeconds,
|
||||
arg.TroubleshootingURL,
|
||||
arg.MOTDFile,
|
||||
arg.DelayLoginUntilReady,
|
||||
arg.LoginBeforeReady,
|
||||
arg.StartupScriptTimeoutSeconds,
|
||||
)
|
||||
var i WorkspaceAgent
|
||||
@ -5175,7 +5175,7 @@ func (q *sqlQuerier) InsertWorkspaceAgent(ctx context.Context, arg InsertWorkspa
|
||||
&i.TroubleshootingURL,
|
||||
&i.MOTDFile,
|
||||
&i.LifecycleState,
|
||||
&i.DelayLoginUntilReady,
|
||||
&i.LoginBeforeReady,
|
||||
&i.StartupScriptTimeoutSeconds,
|
||||
)
|
||||
return i, err
|
||||
|
@ -57,7 +57,7 @@ INSERT INTO
|
||||
connection_timeout_seconds,
|
||||
troubleshooting_url,
|
||||
motd_file,
|
||||
delay_login_until_ready,
|
||||
login_before_ready,
|
||||
startup_script_timeout_seconds
|
||||
)
|
||||
VALUES
|
||||
|
@ -972,7 +972,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
|
||||
ConnectionTimeoutSeconds: prAgent.GetConnectionTimeoutSeconds(),
|
||||
TroubleshootingURL: prAgent.GetTroubleshootingUrl(),
|
||||
MOTDFile: prAgent.GetMotdFile(),
|
||||
DelayLoginUntilReady: prAgent.GetDelayLoginUntilReady(),
|
||||
LoginBeforeReady: prAgent.GetLoginBeforeReady(),
|
||||
StartupScriptTimeoutSeconds: prAgent.GetStartupScriptTimeoutSeconds(),
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -785,7 +785,7 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
|
||||
ConnectionTimeoutSeconds: dbAgent.ConnectionTimeoutSeconds,
|
||||
TroubleshootingURL: troubleshootingURL,
|
||||
LifecycleState: codersdk.WorkspaceAgentLifecycle(dbAgent.LifecycleState),
|
||||
DelayLoginUntilReady: dbAgent.DelayLoginUntilReady,
|
||||
LoginBeforeReady: dbAgent.LoginBeforeReady,
|
||||
StartupScriptTimeoutSeconds: dbAgent.StartupScriptTimeoutSeconds,
|
||||
}
|
||||
node := coordinator.Node(dbAgent.ID)
|
||||
|
Reference in New Issue
Block a user