Skip to content

Commit e2dda7d

Browse files
committed
Fix plumbing
1 parent df9944e commit e2dda7d

File tree

13 files changed

+403
-330
lines changed

13 files changed

+403
-330
lines changed

coderd/apidoc/docs.go

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

coderd/workspaceagents.go

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ func (api *API) workspaceAgentMetadata(rw http.ResponseWriter, r *http.Request)
150150
Directory: apiAgent.Directory,
151151
VSCodePortProxyURI: vscodeProxyURI,
152152
MOTDFile: workspaceAgent.MOTDFile,
153+
StartupScriptTimeout: time.Duration(apiAgent.StartupScriptTimeoutSeconds) * time.Second,
153154
})
154155
}
155156

@@ -739,22 +740,24 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
739740
troubleshootingURL = dbAgent.TroubleshootingURL
740741
}
741742
workspaceAgent := codersdk.WorkspaceAgent{
742-
ID: dbAgent.ID,
743-
CreatedAt: dbAgent.CreatedAt,
744-
UpdatedAt: dbAgent.UpdatedAt,
745-
ResourceID: dbAgent.ResourceID,
746-
InstanceID: dbAgent.AuthInstanceID.String,
747-
Name: dbAgent.Name,
748-
Architecture: dbAgent.Architecture,
749-
OperatingSystem: dbAgent.OperatingSystem,
750-
StartupScript: dbAgent.StartupScript.String,
751-
Version: dbAgent.Version,
752-
EnvironmentVariables: envs,
753-
Directory: dbAgent.Directory,
754-
Apps: apps,
755-
ConnectionTimeoutSeconds: dbAgent.ConnectionTimeoutSeconds,
756-
TroubleshootingURL: troubleshootingURL,
757-
LifecycleState: codersdk.WorkspaceAgentLifecycle(dbAgent.LifecycleState),
743+
ID: dbAgent.ID,
744+
CreatedAt: dbAgent.CreatedAt,
745+
UpdatedAt: dbAgent.UpdatedAt,
746+
ResourceID: dbAgent.ResourceID,
747+
InstanceID: dbAgent.AuthInstanceID.String,
748+
Name: dbAgent.Name,
749+
Architecture: dbAgent.Architecture,
750+
OperatingSystem: dbAgent.OperatingSystem,
751+
StartupScript: dbAgent.StartupScript.String,
752+
Version: dbAgent.Version,
753+
EnvironmentVariables: envs,
754+
Directory: dbAgent.Directory,
755+
Apps: apps,
756+
ConnectionTimeoutSeconds: dbAgent.ConnectionTimeoutSeconds,
757+
TroubleshootingURL: troubleshootingURL,
758+
LifecycleState: codersdk.WorkspaceAgentLifecycle(dbAgent.LifecycleState),
759+
DelayLoginUntilReady: dbAgent.DelayLoginUntilReady,
760+
StartupScriptTimeoutSeconds: dbAgent.StartupScriptTimeoutSeconds,
758761
}
759762
node := coordinator.Node(dbAgent.ID)
760763
if node != nil {

codersdk/workspaceagents.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ type WorkspaceAgent struct {
7777
DERPLatency map[string]DERPRegion `json:"latency,omitempty"`
7878
ConnectionTimeoutSeconds int32 `json:"connection_timeout_seconds"`
7979
TroubleshootingURL string `json:"troubleshooting_url"`
80+
// DelayLoginUntilReady if true, the agent will delay logins until it is ready (e.g. executing startup script has ended).
81+
DelayLoginUntilReady bool `db:"delay_login_until_ready" json:"delay_login_until_ready"`
82+
// StartupScriptTimeoutSeconds 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.
83+
StartupScriptTimeoutSeconds int32 `db:"startup_script_timeout_seconds" json:"startup_script_timeout_seconds"`
8084
}
8185

8286
type WorkspaceAgentResourceMetadata struct {

docs/api/agents.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaceagents/{workspaceagent} \
519519
"architecture": "string",
520520
"connection_timeout_seconds": 0,
521521
"created_at": "2019-08-24T14:15:22Z",
522+
"delay_login_until_ready": true,
522523
"directory": "string",
523524
"disconnected_at": "2019-08-24T14:15:22Z",
524525
"environment_variables": {
@@ -544,6 +545,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaceagents/{workspaceagent} \
544545
"operating_system": "string",
545546
"resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f",
546547
"startup_script": "string",
548+
"startup_script_timeout_seconds": 0,
547549
"status": "connecting",
548550
"troubleshooting_url": "string",
549551
"updated_at": "2019-08-24T14:15:22Z",

0 commit comments

Comments
 (0)