aws / copilot-cli

The AWS Copilot CLI is a tool for developers to build, release and operate production ready containerized applications on AWS App Runner or Amazon ECS on AWS Fargate.
https://aws.github.io/copilot-cli/
Apache License 2.0
3.5k stars 407 forks source link

[Feature Request]: Support for AWS CodePipeline V2 #5832

Open lennertcc opened 4 months ago

lennertcc commented 4 months ago

Describe your idea/feature/enhancement

Add support for CodePipeline V2: V2 type pipelines have the same structure as a V1 type, along with additional parameters for release safety and trigger configuration.

Proposal

The Copilot manifest could have a new parameter where we can specify which pipeline version to deploy, defaulting to V1 to maintain compatibility

Workaround

Add a CDK override to the pipeline:

  1. copilot pipeline override
  2. Select your pipeline
  3. Select cdk
  4. Change the generated stack.ts to this:
    
    import * as cdk from 'aws-cdk-lib';
    import * as path from 'path';

import { CfnPipeline } from 'aws-cdk-lib/aws-codepipeline';

interface TransformedStackProps extends cdk.StackProps { readonly appName: string; }

export class TransformedStack extends cdk.Stack { public readonly template: cdk.cloudformation_include.CfnInclude; public readonly appName: string;

constructor (scope: cdk.App, id: string, props: TransformedStackProps) {
    super(scope, id, props);
    this.template = new cdk.cloudformation_include.CfnInclude(this, 'Template', {
        templateFile: path.join('.build', 'in.yml'),
    });
    this.appName = props.appName;
    this.transformService();
}

transformService() {
    const service = this.template.getResource("Pipeline") as CfnPipeline;
    service.addPropertyOverride("PipelineType", "V2");
}

}


5. run `copilot pipeline deploy --diff` and verify the output
gautam-nutalapati commented 2 months ago

Related https://github.com/aws/copilot-cli/issues/5751

acidminded95 commented 2 months ago

Hi! Thanks! I was looking for this exactly. But, just to be clear, after selecting cdk in the override menu, the resource I need to select to override is Pipeline, right? I also have the option to override PipelineRole and PipelineRolePolicy but it seems to me the right option is the first one