aws-actions / amazon-ecs-deploy-task-definition

Registers an Amazon ECS task definition and deploys it to an ECS service.
MIT License
627 stars 233 forks source link

Support ECS Service connect #426

Open guns2410 opened 1 year ago

guns2410 commented 1 year ago

Updating the task definition to use Service Connect, I get an error during the deploy process.

* UnexpectedParameter: Unexpected key 'name' found in params.containerDefinitions[0].portMappings[0]
* UnexpectedParameter: Unexpected key 'appProtocol' found in params.containerDefinitions[0].portMappings[0]

With ECS supporting Service connect, name and appProtocol has to be supported in portMappings

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/ECS.html#registerTaskDefinition-property

frannpr commented 1 year ago

how is it going on? any temporary fix? I used cloudmap before Connect existed and without making any changes this error pops up

javalon commented 1 year ago

Hi!

A temporal fix to work with our project consisted in creating a new task version from the AWS Dashboard changing the value of the App protocol (to None) and deleting the Port name (empty).

Be careful when you create a new task version manually. The dashboard form sets a Port name by default when its value is empty, making to fail the Github action again if doesn't delete before.

I hope to help you.

shinenelson commented 1 year ago

This is a problem only if one uses the AWS Management Console to create new task definition revision. To get around this, one could use the Create new version with JSON option while creating the new revision and edit the task definition JSON by hand. I recognize that this is not as intuitive as filling up a form, but that comes at the cost of all of the GitHub Action workflows depending on the same task definitions failing.

frannpr commented 1 year ago

thank you both @shinenelson @javalon very much! It has helped me to understand and solve the problem 💯

guns2410 commented 1 year ago

When you create a new version from the AWS management console, the tasks are updated correctly. However, with the next deployment, the deployment would fail since the ports are named in the management console and not in the task definition.

rockey5520 commented 1 year ago

I am too facing the same problem and wondering if there is a way to fix using Github action rather than adjusting it manually in the console.

rockey5520 commented 1 year ago

@veglos provided a PR https://github.com/aws/aws-sdk-js/pull/4310 it would be awesome if someone could review and merge this solves the problem of not being able to redeploy service via github actions