From 23a4ba63f3319d3846b6a93bc5f934c0c7ecd818 Mon Sep 17 00:00:00 2001 From: Sudipto Baral Date: Tue, 7 Feb 2023 22:42:54 +0600 Subject: [PATCH 1/8] fix: added slack notification post deployment task (#787) Signed-off-by: Sudipto Baral --- examples/sample-app/base/app.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/sample-app/base/app.yaml b/examples/sample-app/base/app.yaml index 5f67ce4669..8ca6564e79 100644 --- a/examples/sample-app/base/app.yaml +++ b/examples/sample-app/base/app.yaml @@ -18,5 +18,6 @@ spec: version: 0.2.7 - name: podtato-head-hat version: 0.1.0 - + postDeploymentTasks: + - post-deployment-notification From 3aed996b57e313d6a2e01b25e4f3f9a8fe5a63da Mon Sep 17 00:00:00 2001 From: Sudipto Baral Date: Wed, 8 Feb 2023 12:16:37 +0600 Subject: [PATCH 2/8] fix: removed postDeploymentTask from the main as not everyone has slack configuration (#787) Signed-off-by: Sudipto Baral --- examples/sample-app/base/app.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/sample-app/base/app.yaml b/examples/sample-app/base/app.yaml index 8ca6564e79..5f67ce4669 100644 --- a/examples/sample-app/base/app.yaml +++ b/examples/sample-app/base/app.yaml @@ -18,6 +18,5 @@ spec: version: 0.2.7 - name: podtato-head-hat version: 0.1.0 - postDeploymentTasks: - - post-deployment-notification + From ef6652a6b1fded37b3fb05e17069db1fb2aa0931 Mon Sep 17 00:00:00 2001 From: Sudipto Baral Date: Wed, 8 Feb 2023 13:02:28 +0600 Subject: [PATCH 3/8] docs: improved documentation on enabling post deployment task(#787) Signed-off-by: Sudipto Baral --- examples/sample-app/README.md | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/examples/sample-app/README.md b/examples/sample-app/README.md index 67f6d83233..39dbeef1bb 100644 --- a/examples/sample-app/README.md +++ b/examples/sample-app/README.md @@ -4,12 +4,35 @@ This example should demonstrate the capabilities of the lifecycle toolkit as ill ![img.png](assets/big-picture.png) -## Prepare Secret for Slack Notification -As a first step, create an incoming webhook according to the instructions -https://api.slack.com/messaging/webhooks +## PostDeployment Slack Notification +This section describes how to **prepare and enable** post deployment task to send notification into slack using webhook. -Afterwards create a secret with the created webhook -> kubectl create secret generic slack-notification --from-literal=SECURE_DATA='{"slack_hook":,"text":"Deployed PodTatoHead Application"}' -n podtato-kubectl -oyaml --dry-run=client > base/slack-secret.yaml +**Create Slack Webhook** + +In the first step, create an incoming slack webhook. Necessary information is available in the [slack api page](https://api.slack.com/messaging/webhooks). +Once you create the webhook, you will get a URL similar to below example. + +`https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX` + +`T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX` is the secret part of the webhook which we would need in the next step. + +**Create slack-secret** + +Create a `slack-secret.yaml` definition using the following command. +This will create a kubernetes secret named `slack-secret.yaml` in the [base](./base) directory. + +```bash +kubectl create secret generic slack-secret --from-literal=SECURE_DATA='{"slack_hook":,"text":"Deployed PodTatoHead Application"}' -n podtato-kubectl -oyaml --dry-run=client > base/slack-secret.yaml +``` +**Enable post deployment task** + +To enable Slack notification add `post-deployment-notification` in as a postDeploymentTasks in the +[app.yaml](base/app.yaml) file as shown below. + +```yaml + postDeploymentTasks: + - post-deployment-notification +``` ## Deploy the Observability Part and Keptn-lifecycle-toolkit > make install From 98f4fcb6bd60bf9482b868647534253b42130c82 Mon Sep 17 00:00:00 2001 From: Sudipto Baral Date: Wed, 8 Feb 2023 18:05:15 +0600 Subject: [PATCH 4/8] docs: added implement-slack-notification task in the docs (#787) Signed-off-by: Sudipto Baral --- .../implement-slack-notification/_index.md | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/content/en/docs/tasks/implement-slack-notification/_index.md diff --git a/docs/content/en/docs/tasks/implement-slack-notification/_index.md b/docs/content/en/docs/tasks/implement-slack-notification/_index.md new file mode 100644 index 0000000000..18dba006b1 --- /dev/null +++ b/docs/content/en/docs/tasks/implement-slack-notification/_index.md @@ -0,0 +1,38 @@ +--- +title: Implement Slack Notification +description: Learn how to implement Slack notification as a post deployment task. +icon: concepts +layout: quickstart +weight: 20 +hidechildren: true # this flag hides all sub-pages in the sidebar-multicard.html +--- + +# Overview +This section describes how to **prepare and enable** post-deployment tasks to send notifications to slack using webhooks. + +## Create Slack Webhook + +At first, create an incoming slack webhook. Necessary information is available in the [slack api page](https://api.slack.com/messaging/webhooks). +Once you create the webhook, you will get a URL similar to below example. + +`https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX` + +`T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX` is the secret part of the webhook which we would need in the next step. + +## Create slack-secret + +Create a `slack-secret.yaml` definition using the following command. +This will create a kubernetes secret named `slack-secret.yaml` in the [base](./base) directory. + +```bash +kubectl create secret generic slack-secret --from-literal=SECURE_DATA='{"slack_hook":,"text":"Deployed PodTatoHead Application"}' -n podtato-kubectl -oyaml --dry-run=client > base/slack-secret.yaml +``` +## Enable post deployment task + +To enable Slack notification add `post-deployment-notification` in as a postDeploymentTasks in the +[examples/sample-app/base/app.yaml](https://github.com/keptn/lifecycle-toolkit/blob/main/examples/sample-app/base/app.yaml) file as shown below. + +```yaml + postDeploymentTasks: + - post-deployment-notification +``` \ No newline at end of file From c59a63bcf4c8c00db50c8d5832d090428ae64bef Mon Sep 17 00:00:00 2001 From: Sudipto Baral Date: Wed, 8 Feb 2023 18:24:24 +0600 Subject: [PATCH 5/8] docs: updated create slack secret instruction (#787) Signed-off-by: Sudipto Baral --- .../en/docs/tasks/implement-slack-notification/_index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/content/en/docs/tasks/implement-slack-notification/_index.md b/docs/content/en/docs/tasks/implement-slack-notification/_index.md index 18dba006b1..42b9d47696 100644 --- a/docs/content/en/docs/tasks/implement-slack-notification/_index.md +++ b/docs/content/en/docs/tasks/implement-slack-notification/_index.md @@ -22,7 +22,8 @@ Once you create the webhook, you will get a URL similar to below example. ## Create slack-secret Create a `slack-secret.yaml` definition using the following command. -This will create a kubernetes secret named `slack-secret.yaml` in the [base](./base) directory. +This will create a kubernetes secret named `slack-secret.yaml` in the [base](./base) directory. Before running +this command change your current directory into `examples/sample-app`. ```bash kubectl create secret generic slack-secret --from-literal=SECURE_DATA='{"slack_hook":,"text":"Deployed PodTatoHead Application"}' -n podtato-kubectl -oyaml --dry-run=client > base/slack-secret.yaml From 0b26a485c0d2f6132b0fe0d7bfd17ce78edf7a03 Mon Sep 17 00:00:00 2001 From: Sudipto Baral Date: Wed, 8 Feb 2023 18:29:53 +0600 Subject: [PATCH 6/8] docs: weight adjusted to to put slack-notification after write task and befor evaluate(#787) Signed-off-by: Sudipto Baral --- .../en/docs/tasks/implement-slack-notification/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/tasks/implement-slack-notification/_index.md b/docs/content/en/docs/tasks/implement-slack-notification/_index.md index 42b9d47696..9c0ea63dd7 100644 --- a/docs/content/en/docs/tasks/implement-slack-notification/_index.md +++ b/docs/content/en/docs/tasks/implement-slack-notification/_index.md @@ -3,7 +3,7 @@ title: Implement Slack Notification description: Learn how to implement Slack notification as a post deployment task. icon: concepts layout: quickstart -weight: 20 +weight: 24 hidechildren: true # this flag hides all sub-pages in the sidebar-multicard.html --- From 3e933100e87d18361d00164dc90716e9ab207aa1 Mon Sep 17 00:00:00 2001 From: Sudipto Baral Date: Wed, 8 Feb 2023 18:35:30 +0600 Subject: [PATCH 7/8] docs: updated sample-app readme wording.(#787) Signed-off-by: Sudipto Baral --- examples/sample-app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sample-app/README.md b/examples/sample-app/README.md index 39dbeef1bb..eccd9c0ab6 100644 --- a/examples/sample-app/README.md +++ b/examples/sample-app/README.md @@ -5,7 +5,7 @@ This example should demonstrate the capabilities of the lifecycle toolkit as ill ![img.png](assets/big-picture.png) ## PostDeployment Slack Notification -This section describes how to **prepare and enable** post deployment task to send notification into slack using webhook. +This section describes how to **prepare and enable** post-deployment tasks to send notifications to slack using webhooks. **Create Slack Webhook** From 95035f09b946d84d2c2a88462281b80a1657f970 Mon Sep 17 00:00:00 2001 From: Sudipto Baral Date: Wed, 8 Feb 2023 19:11:22 +0600 Subject: [PATCH 8/8] docs: removed hyperlink from the docs.(#787) Signed-off-by: Sudipto Baral --- .../en/docs/tasks/implement-slack-notification/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/tasks/implement-slack-notification/_index.md b/docs/content/en/docs/tasks/implement-slack-notification/_index.md index 9c0ea63dd7..cb0f07d892 100644 --- a/docs/content/en/docs/tasks/implement-slack-notification/_index.md +++ b/docs/content/en/docs/tasks/implement-slack-notification/_index.md @@ -22,7 +22,7 @@ Once you create the webhook, you will get a URL similar to below example. ## Create slack-secret Create a `slack-secret.yaml` definition using the following command. -This will create a kubernetes secret named `slack-secret.yaml` in the [base](./base) directory. Before running +This will create a kubernetes secret named `slack-secret.yaml` in the `examples/sample-app/base` directory. Before running this command change your current directory into `examples/sample-app`. ```bash