Skip to content

Commit

Permalink
Merge pull request #154 from abdullah-sl/feature/PLAT-871-cronjob-add…
Browse files Browse the repository at this point in the history
…-ability-to-disable-success-slack-notification

cronjob add ability to disable success slack notification
  • Loading branch information
neal-sl authored Jul 24, 2024
2 parents 522d791 + f8cb751 commit 794dede
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cronjob/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions cronjob/templates/_argo_cron_workflow.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,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
Expand All @@ -142,9 +144,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
Expand Down
6 changes: 6 additions & 0 deletions cronjob/templates/_exit_handler_slack_app.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{{- 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 eq $sendOnSuccess true }}
- name: notice-slack-app-succeeded
container:
image: 332947256684.dkr.ecr.ap-southeast-1.amazonaws.com/curlimages/curl:8.4.0
Expand Down Expand Up @@ -86,6 +89,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
Expand Down Expand Up @@ -180,4 +185,5 @@
]}'
{{ required "exitNotifications.slackApp.webhookUrl must be provided" $slackApp.webhookUrl }}"
]
{{- end -}}
{{- end -}}
2 changes: 2 additions & 0 deletions cronjob/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ exitNotifications:
slackApp: {}
# example
# slackApp:
# sendOnSuccess: true // optional, defaults to true
# sendOnFailure: true // optional, defaults to true
# portalDomain: "https://argo.com"
# webhookUrl: "https://webhook/service/test"
# mention:
Expand Down

0 comments on commit 794dede

Please sign in to comment.