CircleCI-Public / aws-ecs-orb

An orb that simplifies deployment to Amazon's Elastic Container Service (ECS). Supports both EC2 and Fargate launch types.
https://circleci.com/orbs/registry/orb/circleci/aws-ecs
MIT License
51 stars 80 forks source link

aws-ecs/deploy-service-update no --task-definition #196

Closed mikejk8s closed 1 year ago

mikejk8s commented 1 year ago

Orb version: 3.2.0

What happened:

I'm having a problem using aws-ecs/deploy-service-update. CircleCIs build says that task-definition is an unexpected parameter but when I don't have task-definition defined the build starts but the aws command states that --task-definition is required. I looked over the deploy-service-update portion of the orb and I don't see anything that defines task-definition. So I'm not sure if this problem is on my end or if it's simply missing from the orb? Thanks

https://app.circleci.com/pipelines/github/mediavine/mv-wp-qa-infrastructure/441/workflows/4fa9354a-a2c3-456b-964c-01eb14e222c0/jobs/620

Expected behavior:

I should be able to update a task (force new deployment) and the --task-definition looks like it has to be passed to the aws commands.

Additional Information:

          name: ecs-force-new-deployment
          # requires:
            # - update-prod-tfvars
            # - build-nginx
            # - build-apache
            # - check-s2s-for-running-jobs
          filters:
            branches:
              only:
                - /^[na].*$/ #Shrink branch name because of ALB 32 char limit
                #- /^wp-qa-e2e-.*$/\
          #task-definition: $APP_PREFIX-task-${CIRCLE_BRANCH} #TODO: These are wp-qa-e2e-task-$tagname
          #task-definition: test
          #task-definition-arn: arn:aws:ecs:us-east-1:lksdklfsjkldf:task-definition/$APP_PREFIX-task-${CIRCLE_BRANCH}
          family: $APP_PREFIX-task-${CIRCLE_BRANCH} #TODO: This is also wp-qa-e2e-task-$tagname
          cluster: $APP_PREFIX-cluster
          force-new-deployment: true
          aws-access-key-id: AWS_ACCESS_KEY_ID_WPOPS
          aws-region: AWS_DEFAULT_REGION_WPOPS
          aws-secret-access-key: AWS_SECRET_ACCESS_KEY
CleanShot 2023-04-20 at 11 21 45@2x CleanShot 2023-04-20 at 11 24 35@2x
brivu commented 1 year ago

Hey @mikejk8s,

The update_service command works in three steps:

  1. Retrieves the service's previous task definition
  2. Makes changes to the task definition based on the parameters you provide
  3. Updates the the service based on the new task definition.

With what you've provided, it looks like you're build is failing step 1, retrieving the previous task definition with this command:

aws ecs describe-task-definition --task-definition "${ECS_TASK_DEFINITION_NAME}" --include TAGS "$@"

If you look at line 17 in the same script, the ECS_TASK_DEFINITION_NAME is equivalent to family parameter provided in the job. From the looks of the aws error, it looks like the aws command is having issues parsing your family parameter:

$APP_PREFIX-task-${CIRCLE_BRANCH}

Can you try wrapping APP_PREFIX in curly braces like below and try again?

${APP_PREFIX}-task-${CIRCLE_BRANCH}

Hope that helps!