Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan committed Feb 27, 2024
1 parent 919c140 commit 6621e2a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/pipeline/orcabus-stateful-pipeline-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import * as ssm from 'aws-cdk-lib/aws-ssm';
import * as pipelines from 'aws-cdk-lib/pipelines';
import * as codebuild from 'aws-cdk-lib/aws-codebuild';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as codepipeline from 'aws-cdk-lib/aws-codepipeline';
import * as chatbot from 'aws-cdk-lib/aws-chatbot';
import * as codestarnotifications from 'aws-cdk-lib/aws-codestarnotifications';
import { OrcaBusStatefulConfig, OrcaBusStatefulStack } from '../workload/orcabus-stateful-stack';
import { getEnvironmentConfig } from '../../config/constants';

Expand Down Expand Up @@ -108,6 +111,29 @@ export class StatefulPipelineStack extends cdk.Stack {
}),
{ pre: [new pipelines.ManualApprovalStep('PromoteToProd')] }
);

// need to build pipeline so we could add notification at the pipeline construct
pipeline.buildPipeline();

// notification for success/failure
const arteriaDevSlackConfigArn = ssm.StringParameter.valueForTypedStringParameterV2(
this,
'/data_portal/backend/slack_channel'
);
const target = chatbot.SlackChannelConfiguration.fromSlackChannelConfigurationArn(
this,
'SlackChannelConfiguration',
arteriaDevSlackConfigArn
);

pipeline.pipeline.notifyOn('PipelineSlackNotification', target, {
events: [
codepipeline.PipelineNotificationEvents.PIPELINE_EXECUTION_FAILED,
codepipeline.PipelineNotificationEvents.PIPELINE_EXECUTION_SUCCEEDED,
],
detailType: codestarnotifications.DetailType.BASIC,
notificationRuleName: 'orcabus_stateful_pipeline_notification',
});
}
}

Expand Down
26 changes: 26 additions & 0 deletions lib/pipeline/orcabus-stateless-pipeline-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import * as ssm from 'aws-cdk-lib/aws-ssm';
import * as pipelines from 'aws-cdk-lib/pipelines';
import * as codebuild from 'aws-cdk-lib/aws-codebuild';
import * as iam from 'aws-cdk-lib/aws-iam';
import * as chatbot from 'aws-cdk-lib/aws-chatbot';
import * as codepipeline from 'aws-cdk-lib/aws-codepipeline';
import * as codestarnotifications from 'aws-cdk-lib/aws-codestarnotifications';
import { OrcaBusStatelessConfig, OrcaBusStatelessStack } from '../workload/orcabus-stateless-stack';
import { getEnvironmentConfig } from '../../config/constants';

Expand Down Expand Up @@ -117,6 +120,29 @@ export class StatelessPipelineStack extends cdk.Stack {
}),
{ pre: [new pipelines.ManualApprovalStep('PromoteToProd')] }
);

// need to build pipeline so we could add notification at the pipeline construct
pipeline.buildPipeline();

// notification for success/failure
const arteriaDevSlackConfigArn = ssm.StringParameter.valueForTypedStringParameterV2(
this,
'/data_portal/backend/slack_channel'
);
const target = chatbot.SlackChannelConfiguration.fromSlackChannelConfigurationArn(
this,
'SlackChannelConfiguration',
arteriaDevSlackConfigArn
);

pipeline.pipeline.notifyOn('PipelineSlackNotification', target, {
events: [
codepipeline.PipelineNotificationEvents.PIPELINE_EXECUTION_FAILED,
codepipeline.PipelineNotificationEvents.PIPELINE_EXECUTION_SUCCEEDED,
],
detailType: codestarnotifications.DetailType.BASIC,
notificationRuleName: 'orcabus_stateless_pipeline_notification',
});
}
}

Expand Down

0 comments on commit 6621e2a

Please sign in to comment.