From de1dbc09be3cdeb697fa0ea626956de7ef5631e7 Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Fri, 1 Mar 2024 14:43:48 +0100 Subject: [PATCH] Split backstageUser and backstageGroup to avoid error --- mta/README.md | 5 +++-- mta/mta.sw.yaml | 19 +++++++++++++++---- mta/specs/mta-input.json | 5 ++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/mta/README.md b/mta/README.md index 7d5bc127..aa831a0f 100644 --- a/mta/README.md +++ b/mta/README.md @@ -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. diff --git a/mta/mta.sw.yaml b/mta/mta.sw.yaml index ad812f2e..2b33553e 100644 --- a/mta/mta.sw.yaml +++ b/mta/mta.sw.yaml @@ -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 @@ -150,7 +150,7 @@ states: - name: NotifyBackstage type: operation actions: - - condition: .backstageUserOrGroup != null + - condition: .backstageUser != null functionRef: refName: createNotification arguments: @@ -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" diff --git a/mta/specs/mta-input.json b/mta/specs/mta-input.json index 0aff8f31..5e54f179 100644 --- a/mta/specs/mta-input.json +++ b/mta/specs/mta-input.json @@ -5,7 +5,10 @@ "repositoryURL": { "type": "string" }, - "backstageUserOrGroup": { + "backstageUser": { + "type": "string" + }, + "backstageGroup": { "type": "string" } },