Skip to content

Commit 826891a

Browse files
authored
Merge pull request #49 from lorengordon/codebuild-link
Links directly to CodeBuild job instead of the project
2 parents 450910a + 8a42477 commit 826891a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/parsers/codebuild.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,26 @@ class CodeBuildParser {
1515
const buildStatus = _.get(event, "detail.build-status");
1616
const project = _.get(event, "detail.project-name");
1717
const logsUrl = `https://console.aws.amazon.com/cloudwatch/home?region=${event.region}#logEventViewer:group=/aws/codebuild/${project};start=PT5M`;
18-
const projectUrl = `https://console.aws.amazon.com/codebuild/home?region=${event.region}#/projects/${project}/view`;
18+
const buildId = _.split(_.get(event, "detail.build-id"), ":").pop();
19+
const buildUrl = `https://console.aws.amazon.com/codebuild/home?region=${event.region}#/builds/${encodeURIComponent(project + ":" + buildId)}/view/new`;
1920
const fields = [];
2021

2122
let color = Slack.COLORS.neutral;
2223
let title = project;
2324
if (buildStatus === "SUCCEEDED") {
24-
title = `<${projectUrl}|${project}> has finished building`;
25+
title = `<${buildUrl}|${project}> has finished building`;
2526
color = Slack.COLORS.ok;
2627
}
2728
else if (buildStatus === "STOPPED") {
28-
title = `<${projectUrl}|${project}> was stopped`;
29+
title = `<${buildUrl}|${project}> was stopped`;
2930
color = Slack.COLORS.warning;
3031
}
3132
else if (buildStatus === "FAILED") {
32-
title = `<${projectUrl}|${project}> has failed to build`;
33+
title = `<${buildUrl}|${project}> has failed to build`;
3334
color = Slack.COLORS.critical;
3435
}
3536
else if (buildStatus === "IN_PROGRESS") {
36-
title = `<${projectUrl}|${project}> has started building`;
37+
title = `<${buildUrl}|${project}> has started building`;
3738
}
3839

3940
if (buildStatus) {

0 commit comments

Comments
 (0)