feat(runs): workflow drafts, publish with an expected version, delete, enabled flag, run on demand, run stages and statistics (#2061, #2113, #2098)

A disabled workflow is never started by a trigger, another workflow or a
person. Delete is refused while a trigger, another workflow or a run in
progress names it. A parked or ended run restarts from a step.
This commit is contained in:
sam committed 2026-11-22 11:34:49 +11:00
1 parent 9c0d043b57
commit 682995bdf7
15 files changed
+1552 -59

No files matched your search

+390 -3
View File
@@ -2457,6 +2457,21 @@ components:
required:
- body
type: object
PutDraftInputBody:
additionalProperties: false
properties:
body:
description: The draft document, as YAML. It may be unfinished or invalid; publishing checks it.
type: string
revision:
description: The revision of the draft as last read, 0 when there is none; the write is refused with 409 when the stored draft is at another
format: int64
minimum: 0
type: integer
required:
- body
- revision
type: object
PutKeyFieldsInputBody:
additionalProperties: false
properties:
@@ -2528,6 +2543,11 @@ components:
body:
description: The workflow document, as YAML
type: string
expected_version:
description: The latest version the document was edited from, 0 for a new workflow; the save is refused with 409 when another is stored
format: int64
minimum: 0
type: integer
required:
- body
type: object
@@ -2607,6 +2627,14 @@ components:
required:
- version
type: object
RunWorkflowInputBody:
additionalProperties: false
properties:
input:
additionalProperties: {}
description: The workflow's inputs by name
type: object
type: object
RunsActionTrail:
additionalProperties: false
properties:
@@ -2621,6 +2649,32 @@ components:
required:
- decision
type: object
RunsDraftView:
additionalProperties: false
properties:
base_version:
format: int64
type: integer
body:
type: string
name:
type: string
revision:
format: int64
type: integer
updated_at:
format: date-time
type: string
updated_by:
type: string
required:
- name
- body
- base_version
- revision
- updated_by
- updated_at
type: object
RunsDryAction:
additionalProperties: false
properties:
@@ -2703,6 +2757,21 @@ components:
- state
- at
type: object
RunsLastRun:
additionalProperties: false
properties:
at:
format: date-time
type: string
id:
type: string
state:
type: string
required:
- id
- state
- at
type: object
RunsOrigin:
additionalProperties: false
properties:
@@ -2764,6 +2833,8 @@ components:
type: string
detail:
type: string
dry:
type: boolean
error:
type: string
finished_at:
@@ -2789,6 +2860,32 @@ components:
- attempts
- created_at
type: object
RunsStage:
additionalProperties: false
properties:
ended_at:
format: date-time
type:
- string
- "null"
error:
type: string
name:
type: string
started_at:
format: date-time
type:
- string
- "null"
state:
type: string
type:
type: string
required:
- name
- type
- state
type: object
RunsStepType:
additionalProperties: false
properties:
@@ -2826,6 +2923,8 @@ components:
type:
- array
- "null"
definition:
type: string
entries:
items:
$ref: "#/components/schemas/RunsTrailEntry"
@@ -2836,8 +2935,15 @@ components:
$ref: "#/components/schemas/RunsOrigin"
run:
$ref: "#/components/schemas/RunsRunView"
stages:
items:
$ref: "#/components/schemas/RunsStage"
type:
- array
- "null"
required:
- run
- stages
- actions
- entries
type: object
@@ -2865,6 +2971,8 @@ components:
seq:
format: int64
type: integer
step:
type: string
text:
type: string
tool_calls:
@@ -2883,6 +2991,38 @@ components:
- at
- kind
type: object
RunsWorkflowStats:
additionalProperties: false
properties:
active:
format: int64
type: integer
failed:
format: int64
type: integer
last_run:
$ref: "#/components/schemas/RunsLastRun"
succeeded:
format: int64
type: integer
success_rate:
format: double
type:
- number
- "null"
total:
format: int64
type: integer
workflow:
type: string
required:
- workflow
- total
- succeeded
- failed
- active
- last_run
type: object
RunsWorkflowView:
additionalProperties: false
properties:
@@ -2893,6 +3033,8 @@ components:
type: string
created_by:
type: string
enabled:
type: boolean
name:
type: string
steps:
@@ -2911,6 +3053,7 @@ components:
- created_by
- created_at
- steps
- enabled
type: object
Schema:
additionalProperties: false
@@ -3100,6 +3243,14 @@ components:
required:
- text
type: object
SetEnabledInputBody:
additionalProperties: false
properties:
enabled:
type: boolean
required:
- enabled
type: object
SetMemberInputBody:
additionalProperties: false
properties:
@@ -6095,7 +6246,7 @@ paths:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Retry a parked run from a step, keeping the results of the steps before it
summary: Restart a parked or ended run from a step, keeping the results of the steps before it
tags:
- Runs
/api/secret-engines:
@@ -6659,6 +6810,52 @@ paths:
summary: Add or change a trigger
tags:
- Events
/api/workflow-drafts:
get:
operationId: list-workflow-drafts
responses:
"200":
content:
application/json:
schema:
items:
$ref: "#/components/schemas/RunsDraftView"
type:
- array
- "null"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List every workflow's unpublished draft
tags:
- Workflows
/api/workflow-stats:
get:
operationId: list-workflow-stats
responses:
"200":
content:
application/json:
schema:
items:
$ref: "#/components/schemas/RunsWorkflowStats"
type:
- array
- "null"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Count each workflow's runs, with its last run and success rate
tags:
- Workflows
/api/workflow-step-types:
get:
operationId: list-workflow-step-types
@@ -6679,7 +6876,7 @@ paths:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: List the step types a workflow document may name, with their settings schemas
summary: List the step types a workflow document may name, with their titles and settings schemas
tags:
- Workflows
/api/workflows:
@@ -6706,6 +6903,26 @@ paths:
tags:
- Workflows
/api/workflows/{name}:
delete:
operationId: delete-workflow
parameters:
- in: path
name: name
required: true
schema:
type: string
responses:
"204":
description: No Content
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Delete a workflow, unless a trigger or another workflow still names it
tags:
- Workflows
get:
operationId: get-workflow
parameters:
@@ -6768,7 +6985,177 @@ paths:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Save a workflow document as its next version
summary: Publish a workflow document as its next version
tags:
- Workflows
/api/workflows/{name}/draft:
delete:
operationId: discard-workflow-draft
parameters:
- in: path
name: name
required: true
schema:
type: string
responses:
"204":
description: No Content
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Discard a workflow's draft
tags:
- Workflows
get:
operationId: get-workflow-draft
parameters:
- in: path
name: name
required: true
schema:
type: string
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/RunsDraftView"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Get a workflow's unpublished draft
tags:
- Workflows
put:
operationId: put-workflow-draft
parameters:
- description: Lowercase letters and digits, joined by dots or hyphens
in: path
name: name
required: true
schema:
description: Lowercase letters and digits, joined by dots or hyphens
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/PutDraftInputBody"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/RunsDraftView"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Save a workflow's draft, which no run uses until it is published
tags:
- Workflows
/api/workflows/{name}/draft/test-run:
post:
operationId: test-workflow-draft
parameters:
- in: path
name: name
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/RunWorkflowInputBody"
required: true
responses:
"202":
content:
application/json:
schema:
$ref: "#/components/schemas/RunsRunView"
description: Accepted
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: "Test-run a workflow's draft: every action is judged and none that changes something runs"
tags:
- Workflows
/api/workflows/{name}/enabled:
put:
operationId: set-workflow-enabled
parameters:
- in: path
name: name
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/SetEnabledInputBody"
required: true
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/RunsWorkflowView"
description: OK
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Enable or disable a workflow
tags:
- Workflows
/api/workflows/{name}/runs:
post:
operationId: run-workflow
parameters:
- in: path
name: name
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/RunWorkflowInputBody"
required: true
responses:
"202":
content:
application/json:
schema:
$ref: "#/components/schemas/RunsRunView"
description: Accepted
default:
content:
application/problem+json:
schema:
$ref: "#/components/schemas/ErrorModel"
description: Error
summary: Run a workflow now with an input
tags:
- Workflows
/oauth2/callback: