From 243819521103ff7443007f958485a149adc48914 Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Tue, 1 Oct 2024 14:08:22 +0000 Subject: [PATCH] Automated PR from https://github.com/parodos-dev/serverless-workflows/pull/438 --- charts/mta-v7.x/Chart.yaml | 2 +- .../04-sonataflow_mta-analysis-v7.yaml | 169 ++++++++++++------ 2 files changed, 119 insertions(+), 52 deletions(-) diff --git a/charts/mta-v7.x/Chart.yaml b/charts/mta-v7.x/Chart.yaml index 49ae4f79..e6b18a9d 100644 --- a/charts/mta-v7.x/Chart.yaml +++ b/charts/mta-v7.x/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.2.38 +version: 0.2.39 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/mta-v7.x/templates/04-sonataflow_mta-analysis-v7.yaml b/charts/mta-v7.x/templates/04-sonataflow_mta-analysis-v7.yaml index 4c481ab6..ebd69ab7 100755 --- a/charts/mta-v7.x/templates/04-sonataflow_mta-analysis-v7.yaml +++ b/charts/mta-v7.x/templates/04-sonataflow_mta-analysis-v7.yaml @@ -88,6 +88,33 @@ spec: - name: countNonMandatoriesIncidents operation: .applicationAnalysis | [select (.issues[].category!="mandatory")][0] | [.issues[]?.incidents //[]] | .[-1][-1].id type: expression + - name: TaskFailedErrorExitMessage + operation: '{ exitMessage: "The 1st task of the taskGroup " + .taskgroup.id + " is in failed state" }' + type: expression + - name: TrackersDoesNotExistErrorExitMessage + operation: '{ exitMessage: "There are no trackers configured in MTA, cannot export to the issue manager" }' + type: expression + - name: TrackerDoesNotExistErrorExitMessage + operation: '{ exitMessage: "The tracker with the id " + .trackers[0].id + " does not exist, cannot export to the issue manager" }' + type: expression + - name: TrackerProjectsDoesNotExistErrorExitMessage + operation: '{ exitMessage: "There are no trackerProjects associated with the tracker with the id " + .tracker.id + ", cannot export to the issue manager" }' + type: expression + - name: TrackerProjectDoesNotExistErrorExitMessage + operation: '{ exitMessage: "The trackerProject with the id " + .trackerProjects[0].id + " of the tracker with the id " + .tracker.id + " does not exist, cannot export to the issue manager" }' + type: expression + - name: TrackerProjectIssueTypesDoesNotExistErrorExitMessage + operation: '{ exitMessage: "There are no trackerProjectIssueTypes in the trackerProject with the id " + .trackerProject.id + " of the tracker with the id "+ .tracker.id +" does not exist, cannot export to the issue manager" }' + type: expression + - name: successResult + operation: '{ "completedWith":"success", "message": "MTA v7.x analysis completed for " + .repositoryURL, "outputs":[ { "key":"mtaAnalysisResultURL", "value": $SECRET.mta.url + "/hub/applications/" + (.application.id|tostring) + "/analysis/report", "format":"link" }, { "key":"migrationWaveJiraTicketURL", "value": (if .migrationWaveJiraTicket != null then .migrationWaveJiraTicket.link else "" end), "format":"link" } ], "nextWorkflows":[ { "id":"m2k", "name":"Move2Kube workflow" } ] }' + type: expression + - name: mandatoriesIncidentsResult + operation: '{ "completedWith": "error", "message": "MTA analysis for " + .application.repository.url + " completed with " + (.application.mandatoriesIncidents|tostring) + " incidents in mandatory issues. Check the analysis report." + (if .migrationWaveJiraTicket != null then " Application was exported to issue manager." else "" end), "outputs": [ { "key": "mtaAnalysisResultURL", "value": ($SECRET.mta.url + "/hub/applications/" + (.application.id|tostring) + "/analysis/report"), "format": "link" }, { "key": "migrationWaveJiraTicketURL", "value": (if .migrationWaveJiraTicket != null then .migrationWaveJiraTicket.link else "" end), "format": "link" } ] }' + type: expression + - name: errorResult + operation: '{ "completedWith":"error", "message": "MTA analysis for " + .application.repository.url + " failed: " + .exitMessage + ". Check logs of task pod: " + .taskgroup.tasks[0].pod }' + type: expression start: stateName: CreateApplication states: @@ -211,12 +238,18 @@ spec: nextState: GetApplicationAnalysis name: checkReportDone type: switch - - data: - exitMessage: '"The 1st task of the taskGroup " + .taskgroup.id + " is in failed state"' + - actionMode: sequential + actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: TaskFailedErrorExitMessage + name: Fill exitMessage name: TaskFailedError transition: nextState: NotifyFailureBackstage - type: inject + type: operation - actionMode: sequential actions: - actionDataFilter: @@ -310,12 +343,18 @@ spec: nextState: TrackersDoesNotExistError name: TrackersExist type: switch - - data: - exitMessage: '"There are no trackers configured in MTA, cannot export to the issue manager"' + - actionMode: sequential + actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: TrackersDoesNotExistErrorExitMessage + name: Fill exitMessage name: TrackersDoesNotExistError transition: nextState: NotifyFailureBackstage - type: inject + type: operation - actionMode: sequential actions: - actionDataFilter: @@ -340,12 +379,18 @@ spec: nextState: TrackerDoesNotExistError name: TrackerExists type: switch - - data: - exitMessage: '"The tracker with the id " + .trackers[0].id + " does not exist, cannot export to the issue manager"' + - actionMode: sequential + actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: TrackerDoesNotExistErrorExitMessage + name: Fill exitMessage name: TrackerDoesNotExistError transition: nextState: NotifyFailureBackstage - type: inject + type: operation - actionMode: sequential actions: - actionDataFilter: @@ -370,12 +415,18 @@ spec: nextState: TrackerProjectsDoesNotExistError name: TrackerProjectsExist type: switch - - data: - exitMessage: '"There are no trackerProjects associated with the tracker with the id " + .tracker.id + ", cannot export to the issue manager"' + - actionMode: sequential + actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: TrackerProjectsDoesNotExistErrorExitMessage + name: Fill exitMessage name: TrackerProjectsDoesNotExistError transition: nextState: NotifyFailureBackstage - type: inject + type: operation - actionMode: sequential actions: - actionDataFilter: @@ -401,12 +452,18 @@ spec: nextState: TrackerProjectDoesNotExistError name: TrackerProjectExist type: switch - - data: - exitMessage: '"The trackerProject with the id " + .trackerProjects[0].id + " of the tracker with the id " + .tracker.id + " does not exist, cannot export to the issue manager"' + - actionMode: sequential + actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: TrackerProjectDoesNotExistErrorExitMessage + name: Fill exitMessage name: TrackerProjectDoesNotExistError transition: nextState: NotifyFailureBackstage - type: inject + type: operation - actionMode: sequential actions: - actionDataFilter: @@ -432,12 +489,18 @@ spec: nextState: TrackerProjectIssueTypesDoesNotExistError name: TrackerProjectIssueTypesExist type: switch - - data: - exitMessage: '"There are no trackerProjectIssueTypes in the trackerProject with the id " + .trackerProject.id + " of the tracker with the id "+ .tracker.id +" does not exist, cannot export to the issue manager"' + - actionMode: sequential + actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: TrackerProjectIssueTypesDoesNotExistErrorExitMessage + name: Fill exitMessage name: TrackerProjectIssueTypesDoesNotExistError transition: nextState: NotifyFailureBackstage - type: inject + type: operation - actionMode: sequential actions: - actionDataFilter: @@ -529,24 +592,21 @@ spec: transition: nextState: reportCompletion type: operation - - data: - result: - completedWith: success - message: '"MTA v7.x analysis completed for " + .repositoryURL' - nextWorkflows: - - id: m2k - name: Move2Kube workflow - output: - - format: link - key: mtaAnalysisResultURL - value: ($SECRET.mta.url + "/hub/applications/" + (.application.id|tostring) + "/analysis/report") - - format: link - key: migrationWaveJiraTicketURL - value: (if .migrationWaveJiraTicket != null then .migrationWaveJiraTicket.link else "" end) + - actionMode: sequential + actions: + - actionDataFilter: + toStateData: .result + useResults: true + functionRef: + invoke: sync + refName: successResult + name: reportCompletion end: terminate: true name: reportCompletion - type: inject + stateDataFilter: + output: . += .result + type: operation - actionMode: sequential actions: - actionDataFilter: @@ -568,21 +628,21 @@ spec: transition: nextState: reportCompletionWithMandatoriesIncidentsInApplication type: operation - - data: - result: - completedWith: error - message: '"MTA analysis for " + .application.repository.url + " completed with " + (.application.mandatoriesIncidents|tostring) +" incidents in mandatory issues. Check the analysis report." + (if .migrationWaveJiraTicket != null then " Application was exported to issue manager." else "" end)' - output: - - format: link - key: mtaAnalysisResultURL - value: ($SECRET.mta.url + "/hub/applications/" + (.application.id|tostring) + "/analysis/report") - - format: link - key: migrationWaveJiraTicketURL - value: (if .migrationWaveJiraTicket != null then .migrationWaveJiraTicket.link else "" end) + - actionMode: sequential + actions: + - actionDataFilter: + toStateData: .result + useResults: true + functionRef: + invoke: sync + refName: mandatoriesIncidentsResult + name: reportCompletionWithMandatoriesIncidentsInApplication end: terminate: true name: reportCompletionWithMandatoriesIncidentsInApplication - type: inject + stateDataFilter: + output: . += .result + type: operation - actionMode: sequential actions: - actionDataFilter: @@ -603,21 +663,28 @@ spec: transition: nextState: reportFailure type: operation - - data: - result: - completedWith: error - message: '"MTA analysis for " + .application.repository.url + " failed: " + .exitMessage + ". Check logs of task pod: " + .taskgroup.tasks[0].pod' + - actionMode: sequential + actions: + - actionDataFilter: + toStateData: .result + useResults: true + functionRef: + invoke: sync + refName: errorResult + name: reportFailure end: terminate: true name: reportFailure - type: inject + stateDataFilter: + output: . += .result + type: operation timeouts: workflowExecTimeout: duration: PT1H podTemplate: container: resources: {} - image: quay.io/orchestrator/serverless-workflow-mta-v7.x:d02fa3f568d45ef3c60e86c746aa3dd7d6dca84c + image: quay.io/orchestrator/serverless-workflow-mta-v7.x:a322fb12640749c1579f3fa797fd0c3ed312d746 envFrom: - secretRef: name: mta-analysis-v7-creds