mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add workspace restart functionality to API (#25757)
This models restart as durable orchestration of existing stop and start workspace builds instead of adding a new restart transition. Keeping restart as two existing transitions preserves the current build/provisioner model. The child start build is created only after the parent stop build succeeds, rather than being inserted immediately in a pending state. That keeps `workspace_builds` aligned with actual provisioner-ready work and avoids introducing a second pending-build lifecycle that the provisioner and build acquisition paths would need to understand. Refs: https://linear.app/codercom/issue/PLAT-143
This commit is contained in:
Generated
+56
@@ -15721,6 +15721,11 @@ const docTemplate = `{
|
||||
"workspace_agent_resource_monitor:create",
|
||||
"workspace_agent_resource_monitor:read",
|
||||
"workspace_agent_resource_monitor:update",
|
||||
"workspace_build_orchestration:*",
|
||||
"workspace_build_orchestration:create",
|
||||
"workspace_build_orchestration:delete",
|
||||
"workspace_build_orchestration:read",
|
||||
"workspace_build_orchestration:update",
|
||||
"workspace_dormant:*",
|
||||
"workspace_dormant:application_connect",
|
||||
"workspace_dormant:create",
|
||||
@@ -15956,6 +15961,11 @@ const docTemplate = `{
|
||||
"APIKeyScopeWorkspaceAgentResourceMonitorCreate",
|
||||
"APIKeyScopeWorkspaceAgentResourceMonitorRead",
|
||||
"APIKeyScopeWorkspaceAgentResourceMonitorUpdate",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationAll",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationCreate",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationDelete",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationRead",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationUpdate",
|
||||
"APIKeyScopeWorkspaceDormantAll",
|
||||
"APIKeyScopeWorkspaceDormantApplicationConnect",
|
||||
"APIKeyScopeWorkspaceDormantCreate",
|
||||
@@ -18759,6 +18769,42 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.CreateWorkspaceBuildOnSuccessRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"transition"
|
||||
],
|
||||
"properties": {
|
||||
"rich_parameter_values": {
|
||||
"description": "RichParameterValues are applied to the child build. Parameters\nnot listed here fall back to their values from the previous\nbuild, matching normal build behavior.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceBuildParameter"
|
||||
}
|
||||
},
|
||||
"template_version_id": {
|
||||
"description": "TemplateVersionID pins the child build to a specific template\nversion. Pinning requires permission to update the template,\nsince the active version may change before the child build\nruns. When empty, the child build uses the template's active\nversion at the time it runs.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"template_version_preset_id": {
|
||||
"description": "TemplateVersionPresetID selects a preset for the child build.\nIt requires TemplateVersionID to also be set.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"transition": {
|
||||
"description": "Transition must be \"start\". The parent build's transition must\nbe \"stop\".",
|
||||
"enum": [
|
||||
"start"
|
||||
],
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/codersdk.WorkspaceTransition"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.CreateWorkspaceBuildReason": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -18800,6 +18846,14 @@ const docTemplate = `{
|
||||
}
|
||||
]
|
||||
},
|
||||
"on_success": {
|
||||
"description": "OnSuccess queues a follow-up workspace build after this build succeeds.\nIt currently supports restarting a workspace by starting it after a\nsuccessful stop build.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/codersdk.CreateWorkspaceBuildOnSuccessRequest"
|
||||
}
|
||||
]
|
||||
},
|
||||
"orphan": {
|
||||
"description": "Orphan may be set for the Destroy transition.",
|
||||
"type": "boolean"
|
||||
@@ -22759,6 +22813,7 @@ const docTemplate = `{
|
||||
"workspace",
|
||||
"workspace_agent_devcontainers",
|
||||
"workspace_agent_resource_monitor",
|
||||
"workspace_build_orchestration",
|
||||
"workspace_dormant",
|
||||
"workspace_proxy"
|
||||
],
|
||||
@@ -22811,6 +22866,7 @@ const docTemplate = `{
|
||||
"ResourceWorkspace",
|
||||
"ResourceWorkspaceAgentDevcontainers",
|
||||
"ResourceWorkspaceAgentResourceMonitor",
|
||||
"ResourceWorkspaceBuildOrchestration",
|
||||
"ResourceWorkspaceDormant",
|
||||
"ResourceWorkspaceProxy"
|
||||
]
|
||||
|
||||
Generated
+52
@@ -14059,6 +14059,11 @@
|
||||
"workspace_agent_resource_monitor:create",
|
||||
"workspace_agent_resource_monitor:read",
|
||||
"workspace_agent_resource_monitor:update",
|
||||
"workspace_build_orchestration:*",
|
||||
"workspace_build_orchestration:create",
|
||||
"workspace_build_orchestration:delete",
|
||||
"workspace_build_orchestration:read",
|
||||
"workspace_build_orchestration:update",
|
||||
"workspace_dormant:*",
|
||||
"workspace_dormant:application_connect",
|
||||
"workspace_dormant:create",
|
||||
@@ -14294,6 +14299,11 @@
|
||||
"APIKeyScopeWorkspaceAgentResourceMonitorCreate",
|
||||
"APIKeyScopeWorkspaceAgentResourceMonitorRead",
|
||||
"APIKeyScopeWorkspaceAgentResourceMonitorUpdate",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationAll",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationCreate",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationDelete",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationRead",
|
||||
"APIKeyScopeWorkspaceBuildOrchestrationUpdate",
|
||||
"APIKeyScopeWorkspaceDormantAll",
|
||||
"APIKeyScopeWorkspaceDormantApplicationConnect",
|
||||
"APIKeyScopeWorkspaceDormantCreate",
|
||||
@@ -16971,6 +16981,38 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.CreateWorkspaceBuildOnSuccessRequest": {
|
||||
"type": "object",
|
||||
"required": ["transition"],
|
||||
"properties": {
|
||||
"rich_parameter_values": {
|
||||
"description": "RichParameterValues are applied to the child build. Parameters\nnot listed here fall back to their values from the previous\nbuild, matching normal build behavior.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/codersdk.WorkspaceBuildParameter"
|
||||
}
|
||||
},
|
||||
"template_version_id": {
|
||||
"description": "TemplateVersionID pins the child build to a specific template\nversion. Pinning requires permission to update the template,\nsince the active version may change before the child build\nruns. When empty, the child build uses the template's active\nversion at the time it runs.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"template_version_preset_id": {
|
||||
"description": "TemplateVersionPresetID selects a preset for the child build.\nIt requires TemplateVersionID to also be set.",
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
},
|
||||
"transition": {
|
||||
"description": "Transition must be \"start\". The parent build's transition must\nbe \"stop\".",
|
||||
"enum": ["start"],
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/codersdk.WorkspaceTransition"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.CreateWorkspaceBuildReason": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -17008,6 +17050,14 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"on_success": {
|
||||
"description": "OnSuccess queues a follow-up workspace build after this build succeeds.\nIt currently supports restarting a workspace by starting it after a\nsuccessful stop build.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/codersdk.CreateWorkspaceBuildOnSuccessRequest"
|
||||
}
|
||||
]
|
||||
},
|
||||
"orphan": {
|
||||
"description": "Orphan may be set for the Destroy transition.",
|
||||
"type": "boolean"
|
||||
@@ -20831,6 +20881,7 @@
|
||||
"workspace",
|
||||
"workspace_agent_devcontainers",
|
||||
"workspace_agent_resource_monitor",
|
||||
"workspace_build_orchestration",
|
||||
"workspace_dormant",
|
||||
"workspace_proxy"
|
||||
],
|
||||
@@ -20883,6 +20934,7 @@
|
||||
"ResourceWorkspace",
|
||||
"ResourceWorkspaceAgentDevcontainers",
|
||||
"ResourceWorkspaceAgentResourceMonitor",
|
||||
"ResourceWorkspaceBuildOrchestration",
|
||||
"ResourceWorkspaceDormant",
|
||||
"ResourceWorkspaceProxy"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user