constructor()

in src/pipeline-stack.ts [12:51]


  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const repo = codecommit.Repository.fromRepositoryName(this, 'Repository',
      'aws-cdk-zaloni-arena');

    // @ts-ignore
    const pipeline = new CodePipeline(this, 'Pipeline', {
      pipelineName: 'aws-cdk-zaloni-arena',
      crossAccountKeys: true,
      synth: new CodeBuildStep('SynthStep', {
        input: CodePipelineSource.codeCommit(repo, 'pipeline'),
        commands: [
          'npm i',
          'npx projen synth',
        ],
      }),
    });

    try {
      const config = YAML.load(resolve(__dirname, '../config/test.yaml'));
      pipeline.addStage(new MainStage(this, 'test', { config }));
    } catch (err) {
      if ((err as NodeJS.ErrnoException).code != 'ENOENT') {
        throw err;
      }
    }

    try {
      const config = YAML.load(resolve(__dirname, '../config/prod.yaml'));
      pipeline.addStage(new MainStage(this, 'prod', { config }), {
        pre: [new ManualApprovalStep('PromoteToProd')],
      });
    } catch (err) {
      if ((err as NodeJS.ErrnoException).code != 'ENOENT') {
        throw err;
      }
    }

  }