4

I am facing issue while describing ecs task definition via running thorugh bitbucket pipeline.

Issue i face is like below,

An error occurred (ClientException) when calling the DescribeTaskDefinition operation

command i use to execute via shell script in bitbucket pipeline as below,

LATEST_TASK_DEFINITION=$(aws ecs describe-task-definition  --task-definition ${TASK_FAMILY})

echo $LATEST_TASK_DEFINITION \
                 | jq '{containerDefinitions: .taskDefinition.containerDefinitions, volumes: .taskDefinition.volumes}' \
                                          | jq '.containerDefinitions[0].image='\"${DOCKER_IMAGE}\" \
                                                           > /tmp/tmp.json
aws ecs register-task-definition --family ${TASK_FAMILY} --cpu 256 --memory 512 --network-mode awsvpc --requires-compatibilities "FARGATE" --task-role-arn arn:aws:iam::xxxxxxx:role/ECSTaskExecutionRole --execution-role-arn arn:aws:iam::xxxxxxx:role/ECSTaskExecutionRole --cli-input-json file:///tmp/tmp.json

issue in bitbucket

But when i am running same commands from linux terminal its running.

Anyone face such kind of issue?

Thanks in advance.

Marcin
  • 215,873
  • 14
  • 235
  • 294
Hardik Patel
  • 127
  • 2
  • 9

1 Answers1

0

I experienced this issue when I was setting up an ECS cluster, task definition file, and service using Terraform.

It also happened at the point of deployment to an already set-up ECS cluster using Circle CI.

I get the error below when I run terraform apply or when I try to deploy using Circle CI:

An error occurred (ClientException) when calling the DescribeTaskDefinition operation: Unable to describe task definition.

Here's how I resolved it:

For Terraform:

The issue had to do with a typo in the cluster name that was not correct with how the service was referencing it. All I had to was to delete the name for the cluster name and had to retype it. This time the service was able to reference it correctly.

For Circle CI:

The issue had to do with a typo in the cluster name environment variable for the Circle CI project that was not correct with how the service was referencing it. All I had to was to delete the cluster name environment variable and I had to set the correct cluster name environment variable. This time the service was able to reference it correctly.

Reference: Unable to describe task definition

Promise Preston
  • 24,334
  • 12
  • 145
  • 143