diff --git a/charts/move2kube/templates/02-configmap_01-m2k-resources-schemas.yaml b/charts/move2kube/templates/02-configmap_01-m2k-resources-schemas.yaml index fe7f23bf..b85dfd5f 100755 --- a/charts/move2kube/templates/02-configmap_01-m2k-resources-schemas.yaml +++ b/charts/move2kube/templates/02-configmap_01-m2k-resources-schemas.yaml @@ -52,6 +52,19 @@ data: "recipients" ] } + workflow-output-schema.json: |- + { + "$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" + } + } + } kind: ConfigMap metadata: creationTimestamp: null diff --git a/charts/move2kube/templates/04-sonataflow_m2k.yaml b/charts/move2kube/templates/04-sonataflow_m2k.yaml index add3f017..bba98a35 100755 --- a/charts/move2kube/templates/04-sonataflow_m2k.yaml +++ b/charts/move2kube/templates/04-sonataflow_m2k.yaml @@ -53,6 +53,12 @@ spec: - name: formatTransformationErrorExitMessage operation: '{ exitMessage: "Error while saving transformation output: " + (if .error == null then "timeout exception was thrown." else .error end) }' type: expression + - name: successResult + operation: '{ "completedWith":"success", "message": "Move2Kube workflow " + $WORKFLOW.instanceId + " on workspace " + .workspaceId + " and project " + .projectId + " was successful; the output is available in the branch " + .targetBranch + " of your git repository "+ .repositoryURL, "outputs": [ { "key":"Git repository", "value": .repositoryURL, "format":"link" }, { "key":"Git branch", "value": .targetBranch } ] }' + type: expression + - name: errorResult + operation: '{ "completedWith":"error", "message": "Move2Kube workflow " + $WORKFLOW.instanceId + " on workspace " + .workspaceId + " and project " + .projectId + " failed ", "outputs":[ { "key":"Exit message", "value": .exitMessage }, { "key":"Plan retries", "value": (.planRetries|tostring), "format":"number" } ] }' + type: expression start: stateName: StartPlanning states: @@ -238,6 +244,14 @@ spec: refName: createNotification name: createNotification name: createNotification + - actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: errorResult + name: setOutput + name: setOutput completionType: allOf end: terminate: true @@ -272,6 +286,14 @@ spec: refName: createNotification name: createNotification name: createNotification + - actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: successResult + name: setOutput + name: setOutput completionType: allOf end: terminate: true @@ -281,7 +303,7 @@ spec: podTemplate: container: resources: {} - image: quay.io/orchestrator/serverless-workflow-move2kube:ebd909018d91e17bc482b98feedc475044070701 + image: quay.io/orchestrator/serverless-workflow-move2kube:be3e8e3c8099f475b29a7c67b61c6cb604f8b66c envFrom: - secretRef: name: m2k-creds