-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpipeline-stack.ts
42 lines (36 loc) · 1.71 KB
/
pipeline-stack.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { pipelines, aws_ssm as ssm, SecretValue, Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { InfrastructureStage } from './infrastructure-stage';
export class PipelineStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const gitHubToken = ssm.StringParameter.valueForStringParameter(this, '/GITHUB/ACCESS_TOKEN');
const pipeline = new pipelines.CodePipeline(this, 'Pipeline', {
pipelineName: 'Todo-Pipeline',
synth: new pipelines.CodeBuildStep('SynthStep', {
input: pipelines.CodePipelineSource.gitHub('MaiKaY/todo-backend', 'main', {
authentication: SecretValue.plainText(gitHubToken)
}),
installCommands: ['npm install -g aws-cdk'],
commands: ['npm ci', 'npm run test:unit', 'npm run build', 'npx cdk synth']
}),
dockerEnabledForSelfMutation: true,
dockerEnabledForSynth: true
});
const productionInfrastructure = new InfrastructureStage(this, 'Production', {
environment: 'Production'
});
pipeline.addStage(productionInfrastructure);
// const stagingInfrastructure = new InfrastructureStage(this, 'Staging', {
// environment: 'Staging'
// });
// pipeline.addStage(stagingInfrastructure);
//
// const productionInfrastructure = new InfrastructureStage(this, 'Production', {
// environment: 'Production'
// });
// pipeline.addStage(productionInfrastructure, {
// pre: [new pipelines.ManualApprovalStep('Approve')]
// });
}
}