Skip to content

Commit

Permalink
adjust MTV assessment to new results schema
Browse files Browse the repository at this point in the history
FLPATH-1734
https://issues.redhat.com/browse/FLPATH-1734

Signed-off-by: Yaron Dayagi <[email protected]>
  • Loading branch information
ydayagi authored and gabriel-farache committed Oct 7, 2024
1 parent 968ab06 commit f1cf821
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mtv-plan/mtv.sw.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
specVersion: "0.8"
id: mtv-plan
version: '1.0'
version: "1.0"
name: MTV plan assessment workflow
description: assessment creates a plan and waits for it to be ready or failed
annotations:
Expand All @@ -10,16 +10,18 @@ extensions:
- extensionid: workflow-uri-definitions
definitions:
notifications: "https://raw.githubusercontent.com/parodos-dev/serverless-workflows/main/shared/specs/notifications-openapi.yaml"
- extensionid: workflow-output-schema
outputSchema: schemas/workflow-output-schema.json
start: CreatePlan
functions:
- name: createNotification
operation: notifications#createNotification
- name: createPlan
type: rest
operation: 'specs/mtv.yaml#createPlan'
operation: "specs/mtv.yaml#createPlan"
- name: getPlan
type: rest
operation: 'specs/mtv.yaml#getPlan'
operation: "specs/mtv.yaml#getPlan"
- name: getPlanError
type: expression
operation: .getStatusResult.status.conditions | map(select(.category == "Error" or .category == "Critical"))[0].message
Expand Down Expand Up @@ -101,7 +103,7 @@ states:
topic: "MTV plan assessment workflow"
severity: "critical"
stateDataFilter:
output: '{assessmentResult: {passed: false, message: .planErrorMessage}}'
output: '{result: {completedWith: "error", message: .planErrorMessage}}'
end: true
- name: PlanReady
type: operation
Expand All @@ -119,5 +121,5 @@ states:
topic: "MTV plan assessment workflow"
severity: "normal"
stateDataFilter:
output: '{workflowOptions: {migrationOptions: [{id: "mtv-migration", name: "MTV migration workflow"}]}, assessmentResult: {passed: true, message: "plan is ready for migration"}}'
output: '{result: {completedWith: "success", message: "MTV plan successful", "nextWorkflows": [{id: "mtv-migration", name: "MTV migration workflow"}], "outputs": [] }}'
end: true
12 changes: 12 additions & 0 deletions mtv-plan/schemas/workflow-output-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "WorkflowResult",
"description": "Schema of workflow output",
"type": "object",
"properties": {
"result": {
"$ref": "../shared/schemas/workflow-result-schema.json",
"type": "object"
}
}
}

0 comments on commit f1cf821

Please sign in to comment.