in pipelines/src/static-site-pipeline.ts [10:59]
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);
const pipeline = new codepipeline.Pipeline(this, 'Pipeline', {
pipelineName: 'reinvent-trivia-game-static-site',
});
new notifications.CfnNotificationRule(this, 'PipelineNotifications', {
name: pipeline.pipelineName,
detailType: 'FULL',
resource: pipeline.pipelineArn,
eventTypeIds: [ 'codepipeline-pipeline-pipeline-execution-failed' ],
targets: [
{
targetType: 'SNS',
targetAddress: cdk.Stack.of(this).formatArn({
service: 'sns',
resource: 'reinvent-trivia-notifications'
}),
}
]
});
// Source
const githubConnection = cdk.Fn.importValue('TriviaGamePipelinesCodeStarConnection');
const sourceOutput = new codepipeline.Artifact('SourceArtifact');
const sourceAction = new actions.CodeStarConnectionsSourceAction({
actionName: 'GitHubSource',
owner: 'aws-samples',
repo: 'aws-reinvent-2019-trivia-game',
connectionArn: githubConnection,
output: sourceOutput
});
pipeline.addStage({
stageName: 'Source',
actions: [sourceAction],
});
// Deploy to test site
pipeline.addStage({
stageName: 'Test',
actions: [this.createDeployAction('Test', sourceOutput)]
});
// Deploy to prod site
pipeline.addStage({
stageName: 'Prod',
actions: [this.createDeployAction('Prod', sourceOutput)]
});
}