copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

[Feature Request]: Support for AWS CodePipeline V2

Open lennertcc opened this issue 1 year ago • 2 comments

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");
    }
}
  1. run copilot pipeline deploy --diff and verify the output

lennertcc avatar Jun 07 '24 09:06 lennertcc

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

gautam-nutalapati avatar Jul 26 '24 16:07 gautam-nutalapati

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

acidminded95 avatar Jul 31 '24 15:07 acidminded95