Skip to content

v2-not-working?

0

You are receiving this message because you created one or more pipelines in the past 8 weeks. AWS CodePipeline provides two pipeline types: V1 and V2. These pipeline types differ in the features supported and in their pricing [1]. Currently, pipelines are created as V1 pipelines by default. To create a V2 pipeline, you need to set it as the pipeline type. Beginning December 9, 2024, AWS CodePipeline will create pipelines as a V2 type when the pipeline type is not specified. This change is applicable when creating pipelines using the AWS SDK, CLI, CloudFormation, or CDK. Existing pipelines are not affected by this change. Since the V2 pipeline type is compatible with the V1 pipeline type, there is no immediate action required.

template code <code> AWSTemplateFormatVersion: '2010-09-09' Description: Stack for deploying a resources using CodePipeline and GitHub

Parameters: GitHubToken: Type: String NoEcho: true Description: "GitHub OAuth Token"

GitHubUser: Type: String Description: "GitHub Username"

GitHubRepo: Type: String Description: "GitHub Repository Name"

GitHubBranch: Type: String Default: "main" Description: "GitHub Branch Name"

Resources: WebsiteBucket: Type: 'AWS::S3::Bucket' Properties: BucketName: !Sub "${AWS::StackName}-website-bucket" WebsiteConfiguration: IndexDocument: index.html ErrorDocument: error.html PublicAccessBlockConfiguration: BlockPublicAcls: false IgnorePublicAcls: false BlockPublicPolicy: false RestrictPublicBuckets: false

CodePipelineServiceRole: Type: 'AWS::IAM::Role' Properties: AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Service: codepipeline.amazonaws.com Action: sts:AssumeRole Path: "/" Policies: - PolicyName: CodePipelineServicePolicy PolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Action: - "s3:CreateBucket" - "s3:DeleteBucket" - "s3:PutObject" - "s3:GetObject" - "s3:DeleteObject" - "s3:ListBucket" Resource: "*"

CodePipeline: Type: 'AWS::CodePipeline::Pipeline' Properties: RoleArn: !GetAtt CodePipelineServiceRole.Arn ArtifactStore: Type: S3 Location: !Ref WebsiteBucket Stages: - Name: Source Actions: - Name: Source ActionTypeId: Category: Source Owner: ThirdParty Provider: GitHub Version: 2 OutputArtifacts: - Name: SourceOutput Configuration: Owner: !Ref GitHubUser Repo: !Ref GitHubRepo Branch: !Ref GitHubBranch OAuthToken: !Ref GitHubToken RunOrder: 1 - Name: Deploy Actions: - Name: Deploy ActionTypeId: Category: Deploy Owner: AWS Provider: S3 Version: 2 InputArtifacts: - Name: SourceOutput Configuration: BucketName: !Ref WebsiteBucket Extract: true RunOrder: 1

Outputs: WebsiteURL: Value: !GetAtt WebsiteBucket.WebsiteURL Description: URL for the static website

</code>

asked 2 years ago461 views

2 Answers
0

The issue you're experiencing with the V2 pipeline not working is likely because your template is not explicitly setting the pipeline type to V2. Currently, pipelines are created as V1 by default, and to create a V2 pipeline, you need to specify it in your template.

To resolve this, you should add the 'PipelineType' property to your CodePipeline resource in the CloudFormation template. Modify the CodePipeline resource as follows:

CodePipeline:
Type: 'AWS::CodePipeline::Pipeline'
Properties:
PipelineType: 'V2'
RoleArn: !GetAtt CodePipelineServiceRole.Arn
ArtifactStore:
Type: S3
Location: !Ref WebsiteBucket
Stages:
# ... (rest of your stages configuration)

By adding 'PipelineType: 'V2'', you're explicitly setting the pipeline to use the V2 type. This should allow you to use V2 features like parameterized pipelines and source revision overrides.

Also, ensure that your IAM role (CodePipelineServiceRole in your template) has the necessary permissions for V2 pipeline operations. You might need to update the policy to include any new permissions required for V2 pipelines.

Remember that V2 pipelines have different features and pricing compared to V1 pipelines. Make sure you're familiar with these differences and that they align with your project requirements.

If you continue to experience issues after making these changes, you may want to review the pipeline execution history and check for any specific error messages that could provide more insight into the problem.
Sources
AWS CodePipeline supports parameterized pipelines
AWS CodePipeline supports starting a pipeline execution with source revision overrides

answered 2 years ago

  • In case of GitHub connections, can I use v2 in my template? because this is not working Stages: - Name: Source Actions: - Name: Source ActionTypeId: Category: Source Owner: ThirdParty Provider: GitHub Version: 2 # Version 1 for GitHub action OutputArtifacts: - Name: SourceOutput Configuration: Owner: !Ref GitHubUser Repo: !Ref GitHubRepo Branch: !Ref GitHubBranch OAuthToken: !Ref GitHubToken RunOrder: 1 - Name: Deploy Actions: - Name: Deploy ActionTypeId: Category: Deploy Owner: AWS Provider: S3 Version: 2 # Version 1 for S3 deploy action InputArtifacts: - Name: SourceOutput Configuration: BucketName: !Ref WebsiteBucket Extract: true RunOrder: 1

0

The email you had initially referenced is for pipeline types of V1 and V2. There are two versions of GitHub integrations as explained well by the previous post. GitHub version 2 is enabled through CodeConnections, and when using that with v2 type pipeline, you can use trigger filtering capabilities. What error are you getting?

Name: Source
Actions:
  - InputArtifacts: []
    ActionTypeId:
      Version: '1'
      Owner: AWS
      Category: Source
      Provider: CodeStarSourceConnection
    OutputArtifacts:
      - Name: SourceArtifact
    RunOrder: 1
    Configuration:
      ConnectionArn: "arn:aws:codestar-connections:region:account-id:connection/connection-id"
      FullRepositoryId: "some-user/my-repo"
      BranchName: "main"
      OutputArtifactFormat: "CODE_ZIP"
    Name: ApplicationSource

Here's how you go from GitHub v1 to the new integration model.

AWS
EXPERT

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.