From ad99255978a86c1adb77fa2ca843109215eaf88d Mon Sep 17 00:00:00 2001 From: Abdullah Jawaid Date: Fri, 7 Jun 2024 15:11:26 +0800 Subject: [PATCH 1/5] feat(cronjob): add sendOnSuccess and sendOnFailure --- cronjob/templates/_exit_handler_slack_app.tpl | 8 ++++++++ cronjob/values.yaml | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/cronjob/templates/_exit_handler_slack_app.tpl b/cronjob/templates/_exit_handler_slack_app.tpl index 44345ae..8af797a 100644 --- a/cronjob/templates/_exit_handler_slack_app.tpl +++ b/cronjob/templates/_exit_handler_slack_app.tpl @@ -1,5 +1,9 @@ {{- define "cronjob._exit_handler_slack_app" -}} {{- $slackApp := .Values.exitNotifications.slackApp | default dict -}} +{{- $sendOnSuccess := list nil true "true" | has $slackApp.sendOnSuccess -}} +{{- $sendOnFailure := list nil true "true" | has $slackApp.sendOnFailure -}} +{{- if or $sendOnSuccess $sendOnFailure }} + {{- if eq $sendOnSuccess true }} - name: notice-slack-app-succeeded container: image: 332947256684.dkr.ecr.ap-southeast-1.amazonaws.com/curlimages/curl:8.4.0 @@ -86,6 +90,8 @@ ]}' {{ required "exitNotifications.slackApp.webhookUrl must be provided" $slackApp.webhookUrl }}" ] + {{- end -}} + {{- if eq $sendOnFailure true }} - name: notice-slack-app-failed container: image: 332947256684.dkr.ecr.ap-southeast-1.amazonaws.com/curlimages/curl:8.4.0 @@ -180,4 +186,6 @@ ]}' {{ required "exitNotifications.slackApp.webhookUrl must be provided" $slackApp.webhookUrl }}" ] + {{- end -}} +{{- end -}} {{- end -}} diff --git a/cronjob/values.yaml b/cronjob/values.yaml index 833d9e3..feb18d4 100644 --- a/cronjob/values.yaml +++ b/cronjob/values.yaml @@ -92,6 +92,10 @@ exitNotifications: slackApp: {} # example # slackApp: + # default to true when not set + # sendOnSuccess: true + # sendOnFailure: true + # portalDomain: "https://argo.com" # webhookUrl: "https://webhook/service/test" # mention: From 5df18a6cbb8b953b94e1a784413da6b3ef1bd5c0 Mon Sep 17 00:00:00 2001 From: Abdullah Jawaid Date: Fri, 7 Jun 2024 17:07:51 +0800 Subject: [PATCH 2/5] chore(): update chart --- cronjob/templates/_argo_cron_workflow.tpl | 4 ++++ cronjob/templates/_exit_handler_slack_app.tpl | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cronjob/templates/_argo_cron_workflow.tpl b/cronjob/templates/_argo_cron_workflow.tpl index 968411c..f79afbd 100644 --- a/cronjob/templates/_argo_cron_workflow.tpl +++ b/cronjob/templates/_argo_cron_workflow.tpl @@ -171,9 +171,11 @@ - # If .Values.exitNotifications.slackApp is set, slackApp will be notify if the job is done {{- if .Values.exitNotifications.slackApp }} + {{- if list nil true "true" | has .Values.exitNotifications.slackApp.sendOnSuccess }} - name: Notice-SlackApp-Succeeded template: notice-slack-app-succeeded {{- end }} + {{- end }} # If .Values.exitNotifications.healthcheckIo is set, Healthcheck IO will be notify if the job is done {{- if .Values.exitNotifications.healthcheckIo }} - name: Notice-HealthcheckIo-Succeeded @@ -185,9 +187,11 @@ - # If .Values.exitNotifications.slackApp is set, slackApp will be notify if the job is failed {{- if .Values.exitNotifications.slackApp }} + {{- if list nil true "true" | has .Values.exitNotifications.slackApp.sendOnFailure }} - name: Notice-SlackApp-Failed template: notice-slack-app-failed {{- end }} + {{- end }} # If .Values.exitNotifications.newRelic is set, New Relic will be notify if the job is failed {{- if .Values.exitNotifications.newRelic }} - name: Notice-NewRelic-Failed diff --git a/cronjob/templates/_exit_handler_slack_app.tpl b/cronjob/templates/_exit_handler_slack_app.tpl index 8af797a..6159574 100644 --- a/cronjob/templates/_exit_handler_slack_app.tpl +++ b/cronjob/templates/_exit_handler_slack_app.tpl @@ -2,7 +2,6 @@ {{- $slackApp := .Values.exitNotifications.slackApp | default dict -}} {{- $sendOnSuccess := list nil true "true" | has $slackApp.sendOnSuccess -}} {{- $sendOnFailure := list nil true "true" | has $slackApp.sendOnFailure -}} -{{- if or $sendOnSuccess $sendOnFailure }} {{- if eq $sendOnSuccess true }} - name: notice-slack-app-succeeded container: @@ -188,4 +187,3 @@ ] {{- end -}} {{- end -}} -{{- end -}} From 8b02a113e1f0578b6a8965029c28d2e154b75c49 Mon Sep 17 00:00:00 2001 From: Abdullah Jawaid Date: Fri, 7 Jun 2024 17:14:29 +0800 Subject: [PATCH 3/5] chore(): update wording and version --- cronjob/Chart.yaml | 2 +- cronjob/values.yaml | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cronjob/Chart.yaml b/cronjob/Chart.yaml index 80a1ec6..ef5f629 100644 --- a/cronjob/Chart.yaml +++ b/cronjob/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 description: Helm chart with simple cronjob template name: cronjob -version: 0.8.0 +version: 0.9.0 appVersion: 1.0.0 tillerVersion: ">=2.14.3" diff --git a/cronjob/values.yaml b/cronjob/values.yaml index feb18d4..cf06ce8 100644 --- a/cronjob/values.yaml +++ b/cronjob/values.yaml @@ -92,9 +92,8 @@ exitNotifications: slackApp: {} # example # slackApp: - # default to true when not set - # sendOnSuccess: true - # sendOnFailure: true + # sendOnSuccess: true // optional, defaults to true + # sendOnFailure: true // optional, defaults to true # portalDomain: "https://argo.com" # webhookUrl: "https://webhook/service/test" From 1a9331b9d4bf7b24174919932c3e6baec5809df8 Mon Sep 17 00:00:00 2001 From: Abdullah Jawaid Date: Fri, 7 Jun 2024 17:15:42 +0800 Subject: [PATCH 4/5] chore(): update indentation --- cronjob/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/cronjob/values.yaml b/cronjob/values.yaml index cf06ce8..3e63a67 100644 --- a/cronjob/values.yaml +++ b/cronjob/values.yaml @@ -94,7 +94,6 @@ exitNotifications: # slackApp: # sendOnSuccess: true // optional, defaults to true # sendOnFailure: true // optional, defaults to true - # portalDomain: "https://argo.com" # webhookUrl: "https://webhook/service/test" # mention: From f8cb751f7a811863d3beca40b3d4199c02a31c1f Mon Sep 17 00:00:00 2001 From: Abdullah Jawaid Date: Wed, 17 Jul 2024 12:17:03 +0800 Subject: [PATCH 5/5] chore(): update version --- cronjob/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cronjob/Chart.yaml b/cronjob/Chart.yaml index ef5f629..190302e 100644 --- a/cronjob/Chart.yaml +++ b/cronjob/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 description: Helm chart with simple cronjob template name: cronjob -version: 0.9.0 +version: 0.10.0 appVersion: 1.0.0 tillerVersion: ">=2.14.3"