Hi Team,
We are using Atlassian integration for build and push the image to ecr repo, but when we are build and push new image to ecr old image renaming as . (dot) , how to rename as any random version like 1.0.0, is it possible please suggest.
image: atlassian/pipelines-awscli
pipelines:
branches:
dev:
- step:
name: Build and Push Docker Image to the DEV ECR
script:
- docker build -t backend:latest .
- pipe: atlassian/aws-ecr-push-image:2.2.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
IMAGE_NAME: backend
TAGS: 'latest'
Hi @eks . Thanks for your question. This is a normal behaviour.
To avoid this situation, just add additional tags besides `latest`. I.e.:
TAGS: 'my-tag latest'
So you will have an image tagged with two tags. After update (new image push), when `latest` tag will be moved to the new image, you will still have old image with `my-tag` tag.
Regards, Igor
Thanks for your answer Igor, If we are using like below it's not renaming the old image, and we need to maintain the image versioning why because if we want rollback last month image simply we can identify thorough and rollback and in this pipeline rollback also not clear, So could you please share the pipeline steps to maintain the image versioning and how to rollback?
TAGS: 'my-tag latest'
We have mentioned image tag is latest in fargate.json file while updating ECS Cluster through Atlassian integration it's pulling that image tag and updating, using image versioning we can update ecs cluster? please suggest this one also Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is hard to understand your case, but i will try.
How to push image with versions via pipe? Here you already mentioned how to build image:
docker build -t backend:latest .
Just add here version tag:
docker build -t backend:latest -t backend:0.0.1 .
Then push this image via pipe.
So you push first image:
TAGS: '0.0.1 latest'
Now you have image on ecr with tags `0.0.1` and latest.
Then you push second image:
TAGS: '0.0.2 latest'
Now you have two images on ecr. First with tag `0.0.1` and the second with tags `0.0.2` and latest. And so on. Now you have images on ECR with versions.
Then you decide to rollback? It means you want to delete your last image or what? If answer is yes, then you should do it manually, because the pipe only pushes images.
Additionally if you have struggle to use this pipe, you could implement your logic via the awscli, then provide here the example of logic you want. If some of the features are missing we will consider to add them to the pipe. If we decide to not include them you could always write your custom pipe with all your needs based on this pipe.
Regards, Igor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.