From 2953ad9c718a0cd208eedb4e2ba01c4471c0627e Mon Sep 17 00:00:00 2001 From: KangManJoo Date: Thu, 3 Oct 2024 13:34:25 +0900 Subject: [PATCH] feat: Add branches for single, multiple, and non-existent repo sources --- notifications_catalog/install.yaml | 420 +++++------------- .../templates/app-deployed.yaml | 22 +- .../templates/app-health-degraded.yaml | 22 +- .../templates/app-sync-failed.yaml | 22 +- .../templates/app-sync-running.yaml | 22 +- .../templates/app-sync-status-unknown.yaml | 33 +- .../templates/app-sync-succeeded.yaml | 33 +- 7 files changed, 259 insertions(+), 315 deletions(-) diff --git a/notifications_catalog/install.yaml b/notifications_catalog/install.yaml index 49bc181f177f95..76f634c7347439 100644 --- a/notifications_catalog/install.yaml +++ b/notifications_catalog/install.yaml @@ -18,37 +18,17 @@ data: message: | {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} is now running new version of deployments manifests. slack: - attachments: | - [{ - "title": "{{ .app.metadata.name}}", - "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", - "color": "#18be52", - "fields": [ - { - "title": "Sync Status", - "value": "{{.app.status.sync.status}}", - "short": true - }, - { - "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", - "short": true - }, - { - "title": "Revision", - "value": "{{.app.status.sync.revision}}", - "short": true - } - {{range $index, $c := .app.status.conditions}} - , - { - "title": "{{$c.type}}", - "value": "{{$c.message}}", - "short": true - } - {{end}} - ] - }] + attachments: "[{\n \"title\": \"{{ .app.metadata.name}}\",\n \"title_link\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\",\n + \ \"color\": \"#18be52\",\n \"fields\": [\n {\n \"title\": \"Sync Status\",\n + \ \"value\": \"{{.app.status.sync.status}}\",\n \"short\": true\n },\n {\n + \ \"title\": \"Repository\",\n \"value\": \n {{- if .app.spec.source + }}\n \"{{ .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources + }}\n {{- range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- + end }}\n {{- else }}\n \"no repoURL\"\n {{- end }}\n \"short\": + true\n },\n {\n \"title\": \"Revision\",\n \"value\": \"{{.app.status.sync.revision}}\",\n + \ \"short\": true\n }\n {{range $index, $c := .app.status.conditions}}\n ,\n + \ {\n \"title\": \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\",\n \"short\": + true\n }\n {{end}}\n ]\n}]\n" deliveryPolicy: Post groupingKey: "" notifyBroadcast: false @@ -74,23 +54,13 @@ data: } {{end}} ] - potentialAction: |- - [{ - "@type":"OpenUri", - "name":"Operation Application", - "targets":[{ - "os":"default", - "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}" - }] - }, - { - "@type":"OpenUri", - "name":"Open Repository", - "targets":[{ - "os":"default", - "uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}" - }] - }] + potentialAction: "[{\n \"@type\":\"OpenUri\",\n \"name\":\"Operation Application\",\n + \ \"targets\":[{\n \"os\":\"default\",\n \"uri\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\"\n + \ }]\n},\n{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Repository\",\n \"targets\":[{\n + \ \"os\":\"default\",\n \"uri\": \n {{- if .app.spec.source }}\n \"{{ + .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources }}\n {{- + range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- end }}\n + \ {{- else }}\n \"no repoURL\"\n {{- end }}\n }]\n}]" themeColor: '#000080' title: New version of an application {{.app.metadata.name}} is up and running. template.app-health-degraded: | @@ -100,32 +70,16 @@ data: {{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} has degraded. Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}. slack: - attachments: | - [{ - "title": "{{ .app.metadata.name}}", - "title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", - "color": "#f4c030", - "fields": [ - { - "title": "Health Status", - "value": "{{.app.status.health.status}}", - "short": true - }, - { - "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", - "short": true - } - {{range $index, $c := .app.status.conditions}} - , - { - "title": "{{$c.type}}", - "value": "{{$c.message}}", - "short": true - } - {{end}} - ] - }] + attachments: "[{\n \"title\": \"{{ .app.metadata.name}}\",\n \"title_link\": \"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\",\n + \ \"color\": \"#f4c030\",\n \"fields\": [\n {\n \"title\": \"Health Status\",\n + \ \"value\": \"{{.app.status.health.status}}\",\n \"short\": true\n },\n + \ {\n \"title\": \"Repository\",\n \"value\": \n {{- if .app.spec.source + }}\n \"{{ .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources + }}\n {{- range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- + end }}\n {{- else }}\n \"no repoURL\"\n {{- end }}\n \"short\": + true\n }\n {{range $index, $c := .app.status.conditions}}\n ,\n {\n \"title\": + \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\",\n \"short\": true\n }\n + \ {{end}}\n ]\n}]\n" deliveryPolicy: Post groupingKey: "" notifyBroadcast: false @@ -147,23 +101,13 @@ data: } {{end}} ] - potentialAction: | - [{ - "@type":"OpenUri", - "name":"Open Application", - "targets":[{ - "os":"default", - "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}" - }] - }, - { - "@type":"OpenUri", - "name":"Open Repository", - "targets":[{ - "os":"default", - "uri":"{{range .app.spec.sources}}{{.repoURL | call .repo.RepoURLToHTTPS}} {{end}}" - }] - }] + potentialAction: "[{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Application\",\n + \ \"targets\":[{\n \"os\":\"default\",\n \"uri\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\"\n + \ }]\n},\n{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Repository\",\n \"targets\":[{\n + \ \"os\":\"default\",\n \"uri\": \n {{- if .app.spec.source }}\n \"{{ + .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources }}\n {{- + range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- end }}\n + \ {{- else }}\n \"no repoURL\"\n {{- end }}\n }]\n}]\n" themeColor: '#FF0000' title: Application {{.app.metadata.name}} has degraded. template.app-sync-failed: | @@ -173,32 +117,16 @@ data: {{if eq .serviceType "slack"}}:exclamation:{{end}} The sync operation of application {{.app.metadata.name}} has failed at {{.app.status.operationState.finishedAt}} with the following error: {{.app.status.operationState.message}} Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true . slack: - attachments: | - [{ - "title": "{{ .app.metadata.name}}", - "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", - "color": "#E96D76", - "fields": [ - { - "title": "Sync Status", - "value": "{{.app.status.sync.status}}", - "short": true - }, - { - "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", - "short": true - } - {{range $index, $c := .app.status.conditions}} - , - { - "title": "{{$c.type}}", - "value": "{{$c.message}}", - "short": true - } - {{end}} - ] - }] + attachments: "[{\n \"title\": \"{{ .app.metadata.name}}\",\n \"title_link\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\",\n + \ \"color\": \"#E96D76\",\n \"fields\": [\n {\n \"title\": \"Sync Status\",\n + \ \"value\": \"{{.app.status.sync.status}}\",\n \"short\": true\n },\n {\n + \ \"title\": \"Repository\",\n \"value\": \n {{- if .app.spec.source + }}\n \"{{ .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources + }}\n {{- range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- + end }}\n {{- else }}\n \"no repoURL\"\n {{- end }}\n \"short\": + true\n }\n {{range $index, $c := .app.status.conditions}}\n ,\n {\n \"title\": + \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\",\n \"short\": true\n }\n + \ {{end}}\n ]\n}]\n" deliveryPolicy: Post groupingKey: "" notifyBroadcast: false @@ -224,23 +152,13 @@ data: } {{end}} ] - potentialAction: |- - [{ - "@type":"OpenUri", - "name":"Open Operation", - "targets":[{ - "os":"default", - "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" - }] - }, - { - "@type":"OpenUri", - "name":"Open Repository", - "targets":[{ - "os":"default", - "uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}" - }] - }] + potentialAction: "[{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Operation\",\n + \ \"targets\":[{\n \"os\":\"default\",\n \"uri\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true\"\n + \ }]\n},\n{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Repository\",\n \"targets\":[{\n + \ \"os\":\"default\",\n \"uri\": \n {{- if .app.spec.source }}\n \"{{ + .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources }}\n {{- + range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- end }}\n + \ {{- else }}\n \"no repoURL\"\n {{- end }} \n }]\n}]" themeColor: '#FF0000' title: Failed to sync application {{.app.metadata.name}}. template.app-sync-running: | @@ -250,32 +168,16 @@ data: The sync operation of application {{.app.metadata.name}} has started at {{.app.status.operationState.startedAt}}. Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true . slack: - attachments: | - [{ - "title": "{{ .app.metadata.name}}", - "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", - "color": "#0DADEA", - "fields": [ - { - "title": "Sync Status", - "value": "{{.app.status.sync.status}}", - "short": true - }, - { - "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", - "short": true - } - {{range $index, $c := .app.status.conditions}} - , - { - "title": "{{$c.type}}", - "value": "{{$c.message}}", - "short": true - } - {{end}} - ] - }] + attachments: "[{\n \"title\": \"{{ .app.metadata.name}}\",\n \"title_link\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\",\n + \ \"color\": \"#0DADEA\",\n \"fields\": [\n {\n \"title\": \"Sync Status\",\n + \ \"value\": \"{{.app.status.sync.status}}\",\n \"short\": true\n },\n {\n + \ \"title\": \"Repository\",\n \"value\": \n {{- if .app.spec.source + }}\n \"{{ .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources + }}\n {{- range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- + end }}\n {{- else }}\n \"no repoURL\"\n {{- end }}\n \"short\": + true\n }\n {{range $index, $c := .app.status.conditions}}\n ,\n {\n \"title\": + \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\",\n \"short\": true\n }\n + \ {{end}}\n ]\n}]\n" deliveryPolicy: Post groupingKey: "" notifyBroadcast: false @@ -301,23 +203,13 @@ data: } {{end}} ] - potentialAction: |- - [{ - "@type":"OpenUri", - "name":"Open Operation", - "targets":[{ - "os":"default", - "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" - }] - }, - { - "@type":"OpenUri", - "name":"Open Repository", - "targets":[{ - "os":"default", - "uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}" - }] - }] + potentialAction: "[{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Operation\",\n + \ \"targets\":[{\n \"os\":\"default\",\n \"uri\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true\"\n + \ }]\n},\n{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Repository\",\n \"targets\":[{\n + \ \"os\":\"default\",\n \"uri\": \n {{- if .app.spec.source }}\n \"{{ + .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources }}\n {{- + range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- end }}\n + \ {{- else }}\n \"no repoURL\"\n {{- end }} \n }]\n}]" title: Start syncing application {{.app.metadata.name}}. template.app-sync-status-unknown: | email: @@ -331,70 +223,34 @@ data: {{end}} {{end}} slack: - attachments: | - [{ - "title": "{{ .app.metadata.name}}", - "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", - "color": "#E96D76", - "fields": [ - { - "title": "Sync Status", - "value": "{{.app.status.sync.status}}", - "short": true - }, - { - "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", - "short": true - } - {{range $index, $c := .app.status.conditions}} - , - { - "title": "{{$c.type}}", - "value": "{{$c.message}}", - "short": true - } - {{end}} - ] - }] + attachments: "[{\n \"title\": \"{{ .app.metadata.name}}\",\n \"title_link\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\",\n + \ \"color\": \"#E96D76\",\n \"fields\": [\n {\n \"title\": \"Sync Status\",\n + \ \"value\": \"{{.app.status.sync.status}}\",\n \"short\": true\n },\n {\n + \ \"title\": \"Repository\",\n \"value\": \n {{- if .app.spec.source + }}\n \"{{ .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources + }}\n {{- range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- + end }}\n {{- else }}\n \"no repoURL\"\n {{- end }}\n \"short\": + true\n }\n {{range $index, $c := .app.status.conditions}}\n ,\n {\n \"title\": + \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\",\n \"short\": true\n }\n + \ {{end}}\n ]\n}]\n" deliveryPolicy: Post groupingKey: "" notifyBroadcast: false teams: - facts: | - [{ - "name": "Sync Status", - "value": "{{.app.status.sync.status}}" - }, - { - "name": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", - } - {{range $index, $c := .app.status.conditions}} - , - { - "name": "{{$c.type}}", - "value": "{{$c.message}}" - } - {{end}} - ] - potentialAction: |- - [{ - "@type":"OpenUri", - "name":"Open Application", - "targets":[{ - "os":"default", - "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}" - }] - }, - { - "@type":"OpenUri", - "name":"Open Repository", - "targets":[{ - "os":"default", - "uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}" - }] - }] + facts: "[{\n \"name\": \"Sync Status\",\n \"value\": \"{{.app.status.sync.status}}\"\n},\n{\n + \ \"name\": \"Repository\",\n \"value\": \n {{- if .app.spec.source }}\n \"{{ + .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources }}\n {{- range + .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- end }}\n {{- else }}\n + \ \"no repoURL\"\n {{- end }}\n}\n{{range $index, $c := .app.status.conditions}}\n + \ ,\n {\n \"name\": \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\"\n + \ }\n{{end}}\n]\n" + potentialAction: "[{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Application\",\n + \ \"targets\":[{\n \"os\":\"default\",\n \"uri\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\"\n + \ }]\n},\n{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Repository\",\n \"targets\":[{\n + \ \"os\":\"default\",\n \"uri\": \n {{- if .app.spec.source }}\n \"{{ + .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources }}\n {{- + range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- end }}\n + \ {{- else }}\n \"no repoURL\"\n {{- end }} \n }]\n}]" title: Application {{.app.metadata.name}} sync status is 'Unknown' template.app-sync-succeeded: | email: @@ -403,74 +259,36 @@ data: {{if eq .serviceType "slack"}}:white_check_mark:{{end}} Application {{.app.metadata.name}} has been successfully synced at {{.app.status.operationState.finishedAt}}. Sync operation details are available at: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true . slack: - attachments: | - [{ - "title": "{{ .app.metadata.name}}", - "title_link":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}", - "color": "#18be52", - "fields": [ - { - "title": "Sync Status", - "value": "{{.app.status.sync.status}}", - "short": true - }, - { - "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", - "short": true - } - {{range $index, $c := .app.status.conditions}} - , - { - "title": "{{$c.type}}", - "value": "{{$c.message}}", - "short": true - } - {{end}} - ] - }] + attachments: "[{\n \"title\": \"{{ .app.metadata.name}}\",\n \"title_link\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}\",\n + \ \"color\": \"#18be52\",\n \"fields\": [\n {\n \"title\": \"Sync Status\",\n + \ \"value\": \"{{.app.status.sync.status}}\",\n \"short\": true\n },\n {\n + \ \"title\": \"Repository\",\n \"value\": \n {{- if .app.spec.source + }}\n \"{{ .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources + }}\n {{- range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- + end }}\n {{- else }}\n \"no repoURL\"\n {{- end }}\n \"short\": + true\n }\n {{range $index, $c := .app.status.conditions}}\n ,\n {\n \"title\": + \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\",\n \"short\": true\n }\n + \ {{end}}\n ]\n}]\n" deliveryPolicy: Post groupingKey: "" notifyBroadcast: false teams: - facts: | - [{ - "name": "Sync Status", - "value": "{{.app.status.sync.status}}" - }, - { - "name": "Synced at", - "value": "{{.app.status.operationState.finishedAt}}" - }, - { - "name": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", - } - {{range $index, $c := .app.status.conditions}} - , - { - "name": "{{$c.type}}", - "value": "{{$c.message}}" - } - {{end}} - ] - potentialAction: |- - [{ - "@type":"OpenUri", - "name":"Operation Details", - "targets":[{ - "os":"default", - "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" - }] - }, - { - "@type":"OpenUri", - "name":"Open Repository", - "targets":[{ - "os":"default", - "uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}" - }] - }] + facts: "[{\n \"name\": \"Sync Status\",\n \"value\": \"{{.app.status.sync.status}}\"\n},\n{\n + \ \"name\": \"Synced at\",\n \"value\": \"{{.app.status.operationState.finishedAt}}\"\n},\n{\n + \ \"name\": \"Repository\",\n \"value\": \n {{- if .app.spec.source }}\n \"{{ + .app.spec.source.repoURL }}\"\n {{- else if .app.spec.sources }}\n {{- + range .app.spec.sources }}\n \"{{ .repoURL }}\"\n {{- end }}\n {{- + else }}\n \"no repoURL\"\n {{- end }}\n}\n{{range $index, $c := .app.status.conditions}}\n + \ ,\n {\n \"name\": \"{{$c.type}}\",\n \"value\": \"{{$c.message}}\"\n + \ }\n{{end}}\n]\n" + potentialAction: "[{\n \"@type\":\"OpenUri\",\n \"name\":\"Operation Details\",\n + \ \"targets\":[{\n \"os\":\"default\",\n \"uri\":\"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true\"\n + \ }]\n},\n{\n \"@type\":\"OpenUri\",\n \"name\":\"Open Repository\",\n \"targets\":[{\n + \ \"os\":\"default\",\n \"uri\": \n {{- if .app.spec.source }}\n \"{{ + .app.spec.source.repoURL | call .repo.RepoURLToHTTPS }}\"\n {{- else if .app.spec.sources + }}\n {{- range .app.spec.sources }}\n \"{{ .repoURL | call .repo.RepoURLToHTTPS + }}\"\n {{- end }}\n {{- else }}\n \"no repoURL\"\n {{- + end }}\n }]\n}]" themeColor: '#000080' title: Application {{.app.metadata.name}} has been successfully synced trigger.on-created: | diff --git a/notifications_catalog/templates/app-deployed.yaml b/notifications_catalog/templates/app-deployed.yaml index 2fa1a8f1266b47..573715420e5232 100644 --- a/notifications_catalog/templates/app-deployed.yaml +++ b/notifications_catalog/templates/app-deployed.yaml @@ -16,7 +16,16 @@ slack: }, { "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", + "value": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} "short": true }, { @@ -72,6 +81,15 @@ teams: "name":"Open Repository", "targets":[{ "os":"default", - "uri":"{{range .app.spec.sources}}{{.repoURL | call .repo.RepoURLToHTTPS}} {{end}}" + "uri": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} }] }] \ No newline at end of file diff --git a/notifications_catalog/templates/app-health-degraded.yaml b/notifications_catalog/templates/app-health-degraded.yaml index a584097752f322..cc01c5d414b2bb 100644 --- a/notifications_catalog/templates/app-health-degraded.yaml +++ b/notifications_catalog/templates/app-health-degraded.yaml @@ -17,7 +17,16 @@ slack: }, { "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", + "value": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} "short": true } {{range $index, $c := .app.status.conditions}} @@ -64,6 +73,15 @@ teams: "name":"Open Repository", "targets":[{ "os":"default", - "uri":"{{range .app.spec.sources}}{{.repoURL | call .repo.RepoURLToHTTPS}} {{end}}" + "uri": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} }] }] diff --git a/notifications_catalog/templates/app-sync-failed.yaml b/notifications_catalog/templates/app-sync-failed.yaml index f52577fe108e70..938cd9f985fa68 100644 --- a/notifications_catalog/templates/app-sync-failed.yaml +++ b/notifications_catalog/templates/app-sync-failed.yaml @@ -17,7 +17,16 @@ slack: }, { "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", + "value": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} "short": true } {{range $index, $c := .app.status.conditions}} @@ -68,6 +77,15 @@ teams: "name":"Open Repository", "targets":[{ "os":"default", - "uri":"{{range .app.spec.sources}}{{.repoURL | call .repo.RepoURLToHTTPS}} {{end}}" + "uri": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} }] }] \ No newline at end of file diff --git a/notifications_catalog/templates/app-sync-running.yaml b/notifications_catalog/templates/app-sync-running.yaml index 78c130ff755337..a79790fb8637f5 100644 --- a/notifications_catalog/templates/app-sync-running.yaml +++ b/notifications_catalog/templates/app-sync-running.yaml @@ -17,7 +17,16 @@ slack: }, { "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", + "value": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} "short": true } {{range $index, $c := .app.status.conditions}} @@ -67,6 +76,15 @@ teams: "name":"Open Repository", "targets":[{ "os":"default", - "uri":"{{range .app.spec.sources}}{{.repoURL | call .repo.RepoURLToHTTPS}} {{end}}" + "uri": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} }] }] \ No newline at end of file diff --git a/notifications_catalog/templates/app-sync-status-unknown.yaml b/notifications_catalog/templates/app-sync-status-unknown.yaml index 43111414f8d166..5eb01f6756f4bc 100644 --- a/notifications_catalog/templates/app-sync-status-unknown.yaml +++ b/notifications_catalog/templates/app-sync-status-unknown.yaml @@ -22,7 +22,16 @@ slack: }, { "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", + "value": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} "short": true } {{range $index, $c := .app.status.conditions}} @@ -44,7 +53,16 @@ teams: }, { "name": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", + "value": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} } {{range $index, $c := .app.status.conditions}} , @@ -68,6 +86,15 @@ teams: "name":"Open Repository", "targets":[{ "os":"default", - "uri":"{{range .app.spec.sources}}{{.repoURL | call .repo.RepoURLToHTTPS}} {{end}}" + "uri": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} }] }] \ No newline at end of file diff --git a/notifications_catalog/templates/app-sync-succeeded.yaml b/notifications_catalog/templates/app-sync-succeeded.yaml index c026320f64e924..e63b7507ac91a1 100644 --- a/notifications_catalog/templates/app-sync-succeeded.yaml +++ b/notifications_catalog/templates/app-sync-succeeded.yaml @@ -17,7 +17,16 @@ slack: }, { "title": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", + "value": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} "short": true } {{range $index, $c := .app.status.conditions}} @@ -44,7 +53,16 @@ teams: }, { "name": "Repository", - "value": "{{range .app.spec.sources}}{{.repoURL}} {{end}}", + "value": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} } {{range $index, $c := .app.status.conditions}} , @@ -68,6 +86,15 @@ teams: "name":"Open Repository", "targets":[{ "os":"default", - "uri":"{{range .app.spec.sources}}{{.repoURL | call .repo.RepoURLToHTTPS}} {{end}}" + "uri": + {{- if .app.spec.source }} + "{{ .app.spec.source.repoURL | call .repo.RepoURLToHTTPS }}" + {{- else if .app.spec.sources }} + {{- range .app.spec.sources }} + "{{ .repoURL | call .repo.RepoURLToHTTPS }}" + {{- end }} + {{- else }} + "no repoURL" + {{- end }} }] }] \ No newline at end of file