constructor()

in lib/workload-pipeline-stack.ts [34:72]


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

    const synthCdkParams =
    ' -c deployment_type='+props.deploymentType +
    ' -c deployment_id='+props.deploymentId +
    ' -c component_account='+props.componentEnv.account +
    ' -c component_region='+props.componentEnv.region;

    const codecommitInput = pipelines.CodePipelineSource.codeCommit(
      codecommit.Repository.fromRepositoryName(this, 'repository', REPOSITORY_NAME),
      'main',
      { trigger: codepipeline_actions.CodeCommitTrigger.NONE },
    );

    const synthStep = new pipelines.CodeBuildStep('synth', {
      input: codecommitInput,
      commands: [
        'npm ci',
        'npx cdk synth -q --verbose' + synthCdkParams,
      ],
    });

    const pipelineName = props.deploymentType + '-' + props.deploymentId + '-pipeline';
    const pipeline = new pipelines.CodePipeline(this, pipelineName, {
      pipelineName: pipelineName,
      selfMutation: true,
      synth: synthStep,
      crossAccountKeys: true,
      cliVersion: CDK_VERSION,
    });

    pipeline.addStage(new ComponentStage(this, props.deploymentId, {
      deploymentId: props.deploymentId,
      deploymentType: props.deploymentType,
      env: props.componentEnv, // defines where the resources will be provisioned
    }));

  }