Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,627
Community Members
 
Community Events
176
Community Groups

AWS ECS deploy task defintion with specific image tag

Hello, i have a pipeline to deploy to my ECS Cluster with 2 steps , the first one is building new docker image with a new tag for example myimage:3 and in my task-definition.json the image is myimage:2

Is there any methode to update the task-definition.json dynamically with the new generated tag from the pipe? I mean that the new deployed task-definition.json takes myimage:3 and not the tag :2 , currently i change the image tag to 3 in task-definition.json before pushing the new commit

Many thanks

1 answer

@ahmed_derbel update task definition is the method from one component, but updating the image is from another - from ECR. So anyway you will have to update the image in your task definition, unless you use latest tag.

You can commit and get it from commit, or , what is more often - to get previous task definition from AWS, update that json file with jq tool to what you need (and perhaps removing some extra fields that are not going to be passed in update_task_definition method like updated_at, created_at), and pass the task definition to our pipe.

Or I suppose if you have to commit task definition, then you have this file in the repository , that means you can reach it from pipeline in $BITBUCKET_CLONE_DIR. 

So another way to go is to have definition sth like this:

...
image: my-ecr-image:${IMAGE_TAG}

, then define $IMAGE_TAG environment variable and use envsubst tool with your task-definition.json , then pass obtained file to the pipe.

Check out:

https://stedolan.github.io/jq/manual/ or https://linuxcommandlibrary.com/man/jq - jq

https://linux.die.net/man/1/envsubst - envsubst

 

Regards, Galyna

To work with AWS simpler, you can use our https://bitbucket.org/atlassian/aws-ecr-push-image/src/master/ aws-ecr-push-image and https://bitbucket.org/atlassian/aws-ecs-deploy/src/master/ aws-ecs-deploy pipes.

Thank you so much

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events