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

[BUG]: Fail to deploy on Github Actions

Open coding-velociraptor opened this issue 8 months ago • 9 comments
trafficstars

Description:

Starting on Monday 23th February, we are unable to use Copilot v1.34.0 in our Github Actions. When ever we run any copilot svc deploy... command, it fails with the following error:

execute deployment 1 of 1 in group 1: deploy service backend to environment staging: deploy service: generate template: override template: unmarsal CDK transformed YAML template: yaml: line 1041: could not find expected ':'

The same output happens when using copilot svc package.... We haven't change any dependency or infrastructure. Dependencies are pinned to be:

{
    "aws-cdk-lib": "2.141.0",
    "aws-cdk": "2.141.0",
}

A later cdk version doesn't work either.

Any advice or hint is highly appreciated.

Update:

It works without the CDK overrides.

Details:

Linux + Mac Copilot v1.34.0

Observed result:

execute deployment 1 of 1 in group 1: deploy service backend to environment staging: deploy service: generate template: override template: unmarsal CDK transformed YAML template: yaml: line 1041: could not find expected ':'

Expected result:

No errors.

Debugging:

Different Github infra, later cdk version

coding-velociraptor avatar Feb 26 '25 12:02 coding-velociraptor

We're facing the exact same issue

felixwuerthcs avatar Feb 26 '25 13:02 felixwuerthcs

this might be related (date/time aligns) to the release of a new github actions standard ubuntu runner that updated aws library versions: https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md

felixwuerthcs avatar Feb 26 '25 14:02 felixwuerthcs

We have tried a Mac OS X runner instead, however it's the same result. Also, we have seen failures before the image change. Are you able to address it with another image?

coding-velociraptor avatar Feb 26 '25 14:02 coding-velociraptor

it seems that you can't define 24.04.1 as a release for the github hosted standard runner. i'm currently trying to override the newer versions of aws cli and sam cli by the old ones within the workflow. this is a workaround to unblock our teams. but it seems that you need to adopt to the updated versions as there's no going back. and overriding it is not so efficent.

felixwuerthcs avatar Feb 26 '25 15:02 felixwuerthcs

this did not help, unfortunately. also downgrading to 22.04 https://github.com/actions/runner-images/blob/ubuntu24/20250223.1/images/ubuntu/Ubuntu2204-Readme.md which does not seem to have all these library updates, did not help.

felixwuerthcs avatar Feb 26 '25 15:02 felixwuerthcs

Are you able to replicate it on our local machine with any aws-cli, aws-cdk, aws-cdk-lib, cdk combination?

coding-velociraptor avatar Feb 26 '25 15:02 coding-velociraptor

no, deployment from local (macOS) to AWS seems to work as far as I know

felixwuerthcs avatar Feb 26 '25 15:02 felixwuerthcs

the only solution for us so far is using docker to build and deploy in the github action.

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Build and run deployment container
        run: |
          docker build -t deploy-image -f Dockerfile.deploy .
          docker run --rm \
            -v ${{ github.workspace }}:/app \
            deploy-image

(i removed specifics from our setup)

felixwuerthcs avatar Feb 26 '25 16:02 felixwuerthcs

@felixwuerthcs thanks for sharing. We were able to mitigate using the Docker image approach. This issue kick-starts our migration away from AWS Copilot CLI, also considering alternatives.

coding-velociraptor avatar Feb 27 '25 10:02 coding-velociraptor

The issue is the CDK Notice system. The CDK-generated Cloudformation gets mixed with Text-based notices which the CDK pushes sometimes.

Our workaround was to add

{
  "notices": false,
  "context": {
    // ...
  }
}

to cdk.json

sveneh avatar Sep 02 '25 08:09 sveneh