defining the name of task definition json to run ecs task in github actions
I haven't been able to define task definition file in GitHub actions to run the task of deploying a container with image stored in my repo in ECR. The error I get is:
Error: Task definition file does not exist: ecs-task-definition.json
So, I believe this happened because of incorrect path mapping or directories. So, what is the right way to specify the name of task json files?
Here's how I have done it:
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ecs-task-definition.json
container-name: adp-ecs-container
image: ${{ steps.build-image.outputs.image }}
for more information and all the relevant screenshots:
https://stackoverflow.com/questions/64538337/github-actions-error-task-definition-file-does-not-exist-when-pushing-and
I hadn't included the task-definition file in my github repo, which github actions searched when defining task definition.
I faced the same issue, then I figured out that I need to download the task definition first then update it with the new container image. that solved the issue and I was able to deploy to ECS.
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition ${{ secrets.ECS_TASK_DEFINITION }} \
--query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: ${{ secrets.ECS_CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}
Relevant questions
Unable to create a new revision of Task Definition
asked 2 years agoForce New Task Definition Revision to run
asked 2 months agoCharging operate Task for execution time
Accepted Answerasked 7 months agoHow to have ECS map ports automatically when a task is deployed in EC2?
asked 2 years agoTask definition container command.
asked 3 months agoPulling docker image from ECR using task definition
asked 8 months agoFargate: how to stop task after finishing
Accepted Answerasked 5 months agoECS Fargate Task in EventBridge has ResourceInitializationError
asked 3 months agodefining the name of task definition json to run ecs task in github actions
asked 2 years agoECS Task Groups
asked 3 years ago