Search code examples
dockergitlab-ciamazon-ecs

AWS Elastic Container Service CI Template issue


I’m on gitlab.com and tried deploying to a fargate AWS ECS container using the instructions for including the Deploy-ECS.gitlab-ci.yml template found here.

It is failing with the following error:

Authenticating with credentials from job payload (GitLab Registry)
$ ecs update-task-definition
An error occurred (InvalidParameterException) when calling the UpdateService operation: Task definition does not support launch_type FARGATE.
Running after_script
00:01
Uploading artifacts for failed job
00:02
ERROR: Job failed: exit code 1

I believe I may have found a solution here where Ryangr() advises that the --requires-compatibilities "FARGATE" flag needs to be on added to the aws ecs register-task-definition command. This is supported by the AWS documentation

In the AWS Management Console, for the Requires Compatibilities field, specify FARGATE.
In the AWS CLI, specify the --requires-compatibilities option.
In the Amazon ECS API, specify the requiresCompatibilities flag.

I'd like to know if there is a way to override the Deploy-ECS.gitlab-ci.yml template and add that or if I just need to submit an issue ticket with GitLab.


Solution

  • Check again with GitLab 13.2 (July 2020):

    Bring Fargate support for ECS to Auto DevOps and ECS template

    We want to make AWS deployments easier.
    In order to do so, we recently delivered a CI/CD template that deploys to AWS ECS:EC2 targets and even connected it to Auto DevOps.

    Scaling container instances in EC2 is a challenge, so many users choose to use AWS Fargate instead of EC2 instances.
    In this release we added Fargate support to the template, which continues to work with Auto DevOps as well, so more users can benefit from it.

    This is linked to issue 218841 which includes the proposal:

    Use the gitlab-ci.yml template for deploying to AWS Fargate.

    We will enforce the presence of --requires-compatibilities argument from the launch type - this will only be passed in case Fargate is selected.
    If ECS is selected as the launch type this is ignored.

    As noted by the David Specht in the comments, this has been closed with issue 218798 and cloud-deploy MR (Merge Request) 16, in commit 2c3d198.