How to update an ECS task with image digest using deploy-service-update job

I am using circleci/aws-ecr build_and_test job to deploy a new image for my project and then trying to use circleci/aws-ecs deploy-service-update job to update the task def and service. This works if I use a common tag between the two jobs. However, I would like to use the new image’s digest value. I can add an intermediate job to use the awscli to query for the digest and set an environment variable named IMAGE_DIGEST but I cannot figure out how to pass this into the deploy-service-update job. I have this:
container-image-name-updates: 'container=${MY_SERVICE_NAME},image=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${MY_REPO_NAME}@${IMAGE_DIGEST}'
but IMAGE_DIGEST is not set.

1 Like