Skip to content

Commit

Permalink
Split backstageUser and backstageGroup to avoid error
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-farache authored and masayag committed Mar 3, 2024
1 parent 5d0813e commit de1dbc0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
5 changes: 3 additions & 2 deletions mta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ the cloud-readiness compatibility of their code.

# Inputs
- `repositoryUrl` [mandatory] - the git repo url to examine
- `backstageUserOrGroup` [optional] - the backstage user or group to send backstage notification with the analysis results
- `backstageUser` [optional] - the backstage user to send backstage notification with the analysis results
- `backstageGroup` [optional] - the backstage group to send backstage notification with the analysis results

# Output
1. On completion the workflow returns an [options structure][2] in the exit state of the workflow (also named variables in SonataFlow)
linking to the [move2kube][3] workflow that will generate k8s manifests for container deployment.
1. When the workflow completes there should be a report link on the exit state of the workflow (also named variables in SonataFlow)
If `backstageUserOrGroup` is set then the link is also attached to a backstage notification.
If `backstageUser` or `backstageGroup` are set then the link is also attached to a backstage notification.
Currently this is working with MTA version 6.2.x and in the future 7.x version the report link will be removed or will be made
optional. Instead of an html report the workflow will use a machine friendly json file.

Expand Down
19 changes: 15 additions & 4 deletions mta/mta.sw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ states:
actionDataFilter:
toStateData: ".applications"
stateDataFilter:
output: "{backstageUserOrGroup: .backstageUserOrGroup, repositoryURL: .repositoryURL, application: .repositoryURL as $r| if .applications == null then null else .applications|map(select(.repository.url == $r))[0] end}"
output: "{backstageUser: .backstageUser, backstageGroup: .backstageGroup, repositoryURL: .repositoryURL, application: .repositoryURL as $r| if .applications == null then null else .applications|map(select(.repository.url == $r))[0] end}"
transition: AppExist
- name: AppExist
type: switch
Expand Down Expand Up @@ -150,7 +150,7 @@ states:
- name: NotifyBackstage
type: operation
actions:
- condition: .backstageUserOrGroup != null
- condition: .backstageUser != null
functionRef:
refName: createNotification
arguments:
Expand All @@ -159,9 +159,20 @@ states:
origin: "MTA Analysis Workflow"
topic: "MTA Analysis Workflow"
targetUsers:
- .backstageUserOrGroup
- .backstageUser
actions:
- title: "View report"
url: "$SECRET.mta_url + \"/hub/applications/\" + (.application.id|tostring) + \"/bucket/\" + .data.output"
- condition: .backstageGroup != null
functionRef:
refName: createNotification
arguments:
title: "MTA analysis completed"
message: '"MTA analysis is completed and the report for " + .application.repository.url + " is ready."'
origin: "MTA Analysis Workflow"
topic: "MTA Analysis Workflow"
targetGroups:
- .backstageUserOrGroup
- .backstageGroup
actions:
- title: "View report"
url: "$SECRET.mta_url + \"/hub/applications/\" + (.application.id|tostring) + \"/bucket/\" + .data.output"
Expand Down
5 changes: 4 additions & 1 deletion mta/specs/mta-input.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"repositoryURL": {
"type": "string"
},
"backstageUserOrGroup": {
"backstageUser": {
"type": "string"
},
"backstageGroup": {
"type": "string"
}
},
Expand Down

0 comments on commit de1dbc0

Please sign in to comment.