Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-farache committed Oct 1, 2024
1 parent 64fa6e1 commit 2438195
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 52 deletions.
2 changes: 1 addition & 1 deletion charts/mta-v7.x/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
169 changes: 118 additions & 51 deletions charts/mta-v7.x/templates/04-sonataflow_mta-analysis-v7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 2438195

Please sign in to comment.