refactor: deprecate login_before_ready in favor of startup_script_behavior (#7837)

Fixes #7758
This commit is contained in:
Mathias Fredriksson
2023-06-06 11:58:07 +03:00
committed by GitHub
parent 93378daeb3
commit 660bbb8d38
37 changed files with 1238 additions and 857 deletions
+17 -2
View File
@@ -76,6 +76,20 @@ var WorkspaceAgentLifecycleOrder = []WorkspaceAgentLifecycle{
WorkspaceAgentLifecycleOff,
}
// WorkspaceAgentStartupScriptBehavior defines whether or not the startup script
// should be considered blocking or non-blocking. The blocking behavior means
// that the agent will not be considered ready until the startup script has
// completed and, for example, SSH connections will wait for the agent to be
// ready (can be overridden).
//
// Presently, non-blocking is the default, but this may change in the future.
type WorkspaceAgentStartupScriptBehavior string
const (
WorkspaceAgentStartupScriptBehaviorBlocking WorkspaceAgentStartupScriptBehavior = "blocking"
WorkspaceAgentStartupScriptBehaviorNonBlocking WorkspaceAgentStartupScriptBehavior = "non-blocking"
)
type WorkspaceAgentMetadataResult struct {
CollectedAt time.Time `json:"collected_at" format:"date-time"`
// Age is the number of seconds since the metadata was collected.
@@ -127,8 +141,9 @@ type WorkspaceAgent struct {
DERPLatency map[string]DERPRegion `json:"latency,omitempty"`
ConnectionTimeoutSeconds int32 `json:"connection_timeout_seconds"`
TroubleshootingURL string `json:"troubleshooting_url"`
// LoginBeforeReady if true, the agent will delay logins until it is ready (e.g. executing startup script has ended).
LoginBeforeReady bool `json:"login_before_ready"`
// Deprecated: Use StartupScriptBehavior instead.
LoginBeforeReady bool `json:"login_before_ready"`
StartupScriptBehavior WorkspaceAgentStartupScriptBehavior `json:"startup_script_behavior"`
// 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.
StartupScriptTimeoutSeconds int32 `json:"startup_script_timeout_seconds"`
ShutdownScript string `json:"shutdown_script,omitempty"`