Skip to content

Commit

Permalink
feat(cdk-pipelines): allow uuid on SlackNotification to be overridden
Browse files Browse the repository at this point in the history
This lets users create multiple stacks of this type.
This is needed because of the singleton lambda.
It is unknown why we use a singleton lambda in the first place.
  • Loading branch information
krissrex committed Jul 15, 2022
1 parent 9aa4678 commit 2470b8f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/cdk-pipelines/slack-notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ export interface SlackNotificationProps {
* @default false
*/
alwaysShowSucceeded?: boolean

/**
* Used to control that only one lambda is created in the account.
*
* Specify a value here when you manually create a {@link SlackNotification} for a pipeline
* without using {@link LifligCdkPipeline.addSlackNotification}.
* For example: `"65f7a9e0-d0a4-4ba7-ad1f-6dec853bbdb8"`.
*
* @default "55954fc8-182e-497e-bd60-7af1496dc222"
*/
singletonLambdaUuid?: string
}

/**
Expand Down Expand Up @@ -60,7 +71,7 @@ export class SlackNotification extends constructs.Construct {
}

const reportFunction = new lambda.SingletonFunction(this, "Function", {
uuid: "55954fc8-182e-497e-bd60-7af1496dc222",
uuid: props.singletonLambdaUuid ?? "55954fc8-182e-497e-bd60-7af1496dc222",
code: lambda.Code.fromAsset(
path.join(__dirname, "../../assets/pipeline-slack-notification-lambda"),
),
Expand Down

0 comments on commit 2470b8f

Please sign in to comment.