Skip to content

Commit

Permalink
v1.1.9
Browse files Browse the repository at this point in the history
* Added CodePipeline and Approval parser
  • Loading branch information
Andre Rabold committed Jan 6, 2019
1 parent c9c2771 commit 210889a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
Binary file modified build/release.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-to-slack",
"version": "1.1.8",
"version": "1.1.9",
"description": "Forward AWS Notification Messages to Slack",
"main": "src/index.js",
"scripts": {
Expand Down
9 changes: 4 additions & 5 deletions src/parsers/codepipeline-approval.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CodePipelineApprovalParser {
//console.log("CodePipeline.Approval :: start...");
//console.log(_.get(event, "Records[0].Sns.Message", "{}"));
return BbPromise.try(() =>
JSON.parse(_.get(event, "Records[0].Sns.Message", "{}")))
JSON.parse(_.get(event, "Records[0].Sns.Message", "{}")))
.catch(_.noop) // ignore JSON errors
.then(message => {

Expand All @@ -21,17 +21,16 @@ class CodePipelineApprovalParser {

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

//const detailType = message.detail-type;
const pipeline = message.approval.pipelineName;
const stage = message.approval.stageName;
const action = message.approval.actionName;
const expires = new Date(message.approval.expires);
// const action = message.approval.actionName;
// const expires = new Date(message.approval.expires);
const reviewLink = message.approval.externalEntityLink;
const approveLink = message.approval.approvalReviewLink;
const customMsg = message.approval.customData;
const time = new Date(_.get(event, "Records[0].Sns.Timestamp"));

var slackTitle = pipeline + " >> APPROVAL REQUIRED for " + stage;
const slackTitle = pipeline + " >> APPROVAL REQUIRED for " + stage;

const slackMessage = {
attachments: [{
Expand Down
8 changes: 2 additions & 6 deletions src/parsers/codepipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ const BbPromise = require("bluebird"),
class CodePipelineParser {

parse(event) {
//console.log("CodePipeline :: start...");
//console.log(_.get(event, "Records[0].Sns.Message", "{}"));
return BbPromise.try(() =>
JSON.parse(_.get(event, "Records[0].Sns.Message", "{}")))
JSON.parse(_.get(event, "Records[0].Sns.Message", "{}")))
.catch(_.noop) // ignore JSON errors
.then(message => {

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

const source = message.source;

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

// Compose the title based upon the best "one line" summary of the state
var slackTitle = pipeline + " >> ";
let slackTitle = pipeline + " >> ";
if(typeProvider == "Manual" && typeCategory == "Approval") {
slackTitle += "APPROVAL REQUIRED for " + stage;
}
Expand Down

0 comments on commit 210889a

Please sign in to comment.