Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

AWS ECS deploy with specific tag name

Ashwani Kumar June 21, 2020 edited

Hi, I am able to create and push docker image on ECR with Bitbucket pipeline. And, now  I want to deploy my container using the pipe - AWS ECS deploy - provided by Bitbucket. But I think there should be an option to pass the tag name. Because it would help me in the rollback, in case of wrong deployment. Currently I can only specify tag in the ECS's container definition only.

I looked at your pipe's code and found out that you are already trying to retrieve the IMAGE_NAME, but it is not mentioned in example. It would be great if you can enable that 😉

Thanks

 

2 answers

0 votes
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 8, 2020

Hi @Ashwani Kumar @TiM 

It's a good case to use envsubst for pre-processing template:

script:
- envsubst < task-definition.tpl.yaml > task-definition.yaml
- cat task-definition.yaml

 Here an example how we use envsubst with a template.


Cheers,
Alex

Ashwani Kumar July 8, 2020

Is it fine to replace Fargate task-defination like this? .. AWS specification says that we need to create new task definition. 🤔 ... But sure I will give it a try 😊

Like Oleksandr Kyrdan likes this
0 votes
Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 22, 2020 edited

@Ashwani Kumar Yes, you are right, it is not explicitly supported.

https://bitbucket.org/atlassian/aws-ecs-deploy/src/dd7bab5f57211073f36a28d268155fb0f0c02ab9/pipe/main.py#lines-117

https://bitbucket.org/atlassian/aws-ecs-deploy/src/dd7bab5f57211073f36a28d268155fb0f0c02ab9/test/test.py#lines-185

 

Actually, you can try to  deploy with IMAGE_NAME variable (like "python:3.7-slim" or something). You could have your pipe definition as:

script:
  - pipe: atlassian/aws-ecs-deploy:1.1.4
    variables:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
      AWS_DEFAULT_REGION: 'us-east-1'
      CLUSTER_NAME: 'your-ecs-cluster'
      SERVICE_NAME: 'your-ecs-service'
      TASK_DEFINITION: 'task-definition.json'
IMAGE_NAME: nginx

Soon we will update the documentation and schema to officially support this, thanks you for the report!

 

Regards, Galyna

Ashwani Kumar June 22, 2020

Thanks 🙂

Ashwani Kumar June 22, 2020 edited

@Halyna Berezovska But, it won't work because, in script, the image parameter in `update_task_definition` method, is not getting updated. `image` parameter is just getting passed to it.

Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 22, 2020

@Ashwani Kumar yes, I see... Looks like this is a bug or not supported feature. Thanks for reporting, I will let you know once that is enrolled fully

Halyna Berezovska
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2020

As a workaround for now I can see you could put tag right to the  definition like you do and before you can remember this tag as a variable if it is possible. Or you could parse definition json file with jq and get the tag.

Ashwani Kumar June 23, 2020

Thanks @Halyna Berezovska , I was thinking on the same page and changed the tag in AWS task definition JSON, which I copied from my Fargate configuration. But, I am having errors "Unknown parameter in input:", So currently I am trying to solve them. 🙂

If this works, then I will have fully automated CI/CD .

TiM
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 30, 2020

any update? this is tragically useless without it :(

Ashwani Kumar June 30, 2020

Hello @TiM , I am still working on that error .. not able to deploy on Fargate. 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira, marketing project management, jira for marketers, agile marketing, campaign planning, marketing workflows, jira templates, atlassian learning, marketing collaboration, project tracking, marketing teams, jira training

Streamline Marketing in Jira 🖼️

Plan, prioritize, and deliver marketing projects seamlessly. See how Jira supports your team's success. Start today!

Start now! 🚦
AUG Leaders

Atlassian Community Events