From f1cf821a416863ed1b3c6645f476400402665a96 Mon Sep 17 00:00:00 2001 From: Yaron Dayagi Date: Tue, 1 Oct 2024 18:22:37 +0300 Subject: [PATCH] adjust MTV assessment to new results schema FLPATH-1734 https://issues.redhat.com/browse/FLPATH-1734 Signed-off-by: Yaron Dayagi --- mtv-plan/mtv.sw.yaml | 12 +++++++----- mtv-plan/schemas/workflow-output-schema.json | 12 ++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 mtv-plan/schemas/workflow-output-schema.json diff --git a/mtv-plan/mtv.sw.yaml b/mtv-plan/mtv.sw.yaml index ba1bb773..c5669210 100644 --- a/mtv-plan/mtv.sw.yaml +++ b/mtv-plan/mtv.sw.yaml @@ -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: @@ -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 @@ -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 @@ -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 diff --git a/mtv-plan/schemas/workflow-output-schema.json b/mtv-plan/schemas/workflow-output-schema.json new file mode 100644 index 00000000..8d3c7005 --- /dev/null +++ b/mtv-plan/schemas/workflow-output-schema.json @@ -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" + } + } +} \ No newline at end of file