You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ci_tools/slack_notifications.js
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,42 @@ const AWS = require('aws-sdk');
4
4
consturl=require('url');
5
5
consthttps=require('https');
6
6
7
+
/*
8
+
This code is intended to be used in an AWS Lambda function triggered by an Amazon CloudWatch Event rule with CodeBuild as source. This was written for demo purposes, and is probably not production ready.
9
+
10
+
Follow these steps to configure the webhook in Slack:
11
+
12
+
Navigate to https://.slack.com/services/new
13
+
Search for and select "Incoming WebHooks".
14
+
Choose the default channel where messages will be sent and click "Add Incoming WebHooks Integration".
15
+
Copy the webhook URL from the setup instructions and use it in the next section.
16
+
17
+
To encrypt your secrets use the following steps:
18
+
19
+
Create or use an existing KMS Key - http://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html
20
+
Click the "Enable Encryption Helpers" checkbox
21
+
Paste <SLACK_HOOK_URL> into the kmsEncryptedHookUrl environment variable and click encrypt Note: You must exclude the protocol from the URL (e.g. "hooks.slack.com/services/abc123").
22
+
Give your function's role permission for the kms:Decrypt action.
23
+
24
+
Example:
25
+
26
+
{
27
+
"Version": "2012-10-17",
28
+
"Statement": [
29
+
{
30
+
"Sid": "Stmt1443036478000",
31
+
"Effect": "Allow",
32
+
"Action": [
33
+
"kms:Decrypt"
34
+
],
35
+
"Resource": [
36
+
"<your KMS key ARN>"
37
+
]
38
+
}
39
+
]
40
+
}
41
+
*/
42
+
7
43
// The base-64 encoded, encrypted key (CiphertextBlob) stored in the kmsEncryptedHookUrl environment variable
0 commit comments