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.49k stars 406 forks source link

upload pipeline template to S3 bucket to handle larger capacities #2068

Closed niros1 closed 3 years ago

niros1 commented 3 years ago

Hello, I added another environment to my pipeline and got the following error "'templateBody' failed to satisfy constraint: Member must have length less than or equal to 51200". For my understanding this is a CFN limitation, how can i avoid that?

efekarakus commented 3 years ago

Oh this is very interesting! Would you mind sharing the change in the pipeline.yml file that cause the template size to be greater than 51200?

Maybe we can help trim the size, there is no short term fix that I can think of for this 🤔 until we upload the template to an S3 bucket

niros1 commented 3 years ago

Just added the prod section (which is currently comment out )

my pipeline.yml

source:
  # The name of the provider that is used to store the source artifacts.
  provider: Bitbucket
  # Additional properties that further specifies the exact location
  # the artifacts should be sourced from. For example, the GitHub provider
  # has the following properties: repository, branch.
  properties:
    branch: master
    repository: url to repository

# The deployment section defines the order the pipeline will deploy
# to your environments.
stages:
  - # The name of the environment to deploy to.
    name: dev
    # Optional: flag for manual approval action before deployment.
    # requires_approval: true
    # Optional: use test commands to validate this stage of your build.
    # test_commands: [echo 'running tests', make test]

  - # The name of the environment to deploy to.
    name: test
    # Optional: flag for manual approval action before deployment.
    requires_approval: true
    # Optional: use test commands to validate this stage of your build.
    # test_commands: [echo 'running tests', make test]

  # - # The name of the environment to deploy to.
  #   name: prod
  #   # Optional: flag for manual approval action before deployment.
  #   requires_approval: true
  #   # Optional: use test commands to validate this stage of your build.
  #   # test_commands: [echo 'running tests', make test]
niros1 commented 3 years ago

From some reason I can't see Janice reply (maybe it was deleted?), according to the mail the suggestion was to use nested stack but I am not sure I can I do that, the Copilot create the stack , not under my control.

huanjani commented 3 years ago

Haha, yes, that was why I deleted it. 😄 Would you mind showing me the template generated when it's successful (without prod)?

niros1 commented 3 years ago

Here it is:

Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

AWSTemplateFormatVersion: '2010-09-09' Description: CodePipeline for bv-brain-core Resources: SourceConnection: Type: AWS::CodeStarConnections::Connection Properties: ConnectionName: copilot-git@b-digiu-be-services ProviderType: Bitbucket BuildProjectRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: 2012-10-17 Statement:

huanjani commented 3 years ago

Thank you for pasting that. It looks like you have 9 services in your app, right? That must be why you're exceeding the 51,200 byte limit when you add a single env. We'll make the fix to upload the template to an S3 bucket as soon as we can! Thanks for bringing this issue to our attention.

niros1 commented 3 years ago

👏🏼

efekarakus commented 3 years ago

Hi @niros1, apologies we had to revert the fix: https://github.com/aws/copilot-cli/pull/2228 🙇 but we're still actively working on it and should be able to send a patch for the fix in a follow-up pull-request.

niros1 commented 3 years ago

10X for letting me know. anyhow it will be avail only in the next release right ?

efekarakus commented 3 years ago

We're planning to release soon v1.6.0 and the fix unfortunately won't be part of that release, but it will be in the next follow-up!

efekarakus commented 3 years ago

@niros1 the fix is officially out in v1.7.0! 🥳 https://github.com/aws/copilot-cli/releases/tag/v1.7.0