Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
fix: main tag report
Browse files Browse the repository at this point in the history
  • Loading branch information
arantespp committed Sep 16, 2021
1 parent 348bf04 commit 2a47c1c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/deploy/cicd/ecsTaskReportCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const sendEcsTaskReport = async ({ status }: { status: Status }) => {

const options = {
status: {
choices: ['Approved', 'Rejected'] as Status[],
choices: ['Approved', 'Rejected', 'MainTagFound'] as Status[],
demandOption: true,
type: 'string',
},
Expand Down
11 changes: 9 additions & 2 deletions packages/cli/src/deploy/cicd/lambdas/ecsTaskReport.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const getEcsTaskLogsUrl = ({ ecsTaskArn }: { ecsTaskArn: string }) => {
return ecsTaskLogsUrl;
};

export type Status = 'Approved' | 'Rejected';
export type Status = 'Approved' | 'Rejected' | 'MainTagFound';

export type Event = {
status: Status;
Expand All @@ -60,14 +60,21 @@ export const ecsTaskReportHandler: Handler<Event> = async ({
await putApprovalResultManualTask({
pipelineName,
result: {
status,
status: status === 'MainTagFound' ? 'Approved' : status,
summary: JSON.stringify({ status, logs }),
},
});
}
};

const handleStackNotification = async () => {
/**
* Do not send a notification if the task was main pipeline with tag.
*/
if (status === 'MainTagFound') {
return;
}

const url = process.env.SLACK_WEBHOOK_URL;

if (!url) {
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/deploy/cicd/pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ export const getMainCommands = () => [
'git fetch',
'git pull origin main',
'git rev-parse HEAD',
'if git describe --exact-match; then echo "Tag found" && exit 0; fi',
/**
* Reporting `MainTagFound` before exiting the process.
*/
'if git describe --exact-match; then echo "Tag found" && carlin cicd-ecs-task-report --status=MainTagFound && exit 0; fi',
'yarn',
executeCommandFile('main'),
];
Expand Down

0 comments on commit 2a47c1c

Please sign in to comment.