Skip to content

Commit 210889a

Browse files
author
Andre Rabold
committed
v1.1.9
* Added CodePipeline and Approval parser
1 parent c9c2771 commit 210889a

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

build/release.zip

2.04 KB
Binary file not shown.

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aws-to-slack",
3-
"version": "1.1.8",
3+
"version": "1.1.9",
44
"description": "Forward AWS Notification Messages to Slack",
55
"main": "src/index.js",
66
"scripts": {

src/parsers/codepipeline-approval.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CodePipelineApprovalParser {
1010
//console.log("CodePipeline.Approval :: start...");
1111
//console.log(_.get(event, "Records[0].Sns.Message", "{}"));
1212
return BbPromise.try(() =>
13-
JSON.parse(_.get(event, "Records[0].Sns.Message", "{}")))
13+
JSON.parse(_.get(event, "Records[0].Sns.Message", "{}")))
1414
.catch(_.noop) // ignore JSON errors
1515
.then(message => {
1616

@@ -21,17 +21,16 @@ class CodePipelineApprovalParser {
2121

2222
console.log(" this IS an APPROVAL message");
2323

24-
//const detailType = message.detail-type;
2524
const pipeline = message.approval.pipelineName;
2625
const stage = message.approval.stageName;
27-
const action = message.approval.actionName;
28-
const expires = new Date(message.approval.expires);
26+
// const action = message.approval.actionName;
27+
// const expires = new Date(message.approval.expires);
2928
const reviewLink = message.approval.externalEntityLink;
3029
const approveLink = message.approval.approvalReviewLink;
3130
const customMsg = message.approval.customData;
3231
const time = new Date(_.get(event, "Records[0].Sns.Timestamp"));
3332

34-
var slackTitle = pipeline + " >> APPROVAL REQUIRED for " + stage;
33+
const slackTitle = pipeline + " >> APPROVAL REQUIRED for " + stage;
3534

3635
const slackMessage = {
3736
attachments: [{

src/parsers/codepipeline.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ const BbPromise = require("bluebird"),
77
class CodePipelineParser {
88

99
parse(event) {
10-
//console.log("CodePipeline :: start...");
11-
//console.log(_.get(event, "Records[0].Sns.Message", "{}"));
1210
return BbPromise.try(() =>
13-
JSON.parse(_.get(event, "Records[0].Sns.Message", "{}")))
11+
JSON.parse(_.get(event, "Records[0].Sns.Message", "{}")))
1412
.catch(_.noop) // ignore JSON errors
1513
.then(message => {
1614

@@ -19,8 +17,6 @@ class CodePipelineParser {
1917
return BbPromise.resolve(false);
2018
}
2119

22-
const source = message.source;
23-
2420
// Check that this is NOT an approval message (there is a separate handler for those...)
2521
// NOTE: CodePipeline Action Execution State Changes that are APPROVALs are handled here,
2622
// only ignore the dedicated Approval request notifications
@@ -37,7 +33,7 @@ class CodePipelineParser {
3733
const time = new Date(message.time);
3834

3935
// Compose the title based upon the best "one line" summary of the state
40-
var slackTitle = pipeline + " >> ";
36+
let slackTitle = pipeline + " >> ";
4137
if(typeProvider == "Manual" && typeCategory == "Approval") {
4238
slackTitle += "APPROVAL REQUIRED for " + stage;
4339
}

0 commit comments

Comments
 (0)