Hi Team,
We are using below script to deploying the AWS ECS, it's trying to updating ecs service but not updating and it's sitting old revision and ecr latest image also not updating can some one suggest how to deploy aws ecs using bitbucket pipeline.
Mentioned below yml file.
@Venkat P Thanks for your question. Please, take a look at this answer.
Regards, Igor
Thanks for you answer Igor,
still I'm getting below error, I have mentioned my yml file below can you please suggest anything need to add?
Error: Docker push error: EOF
image: python:3.7.4-alpine3.10
pipelines:
tags:
ecr-release-*:
- step:
name: build & push the docker image
services:
- docker
caches:
- pip
oidc: true
script:
# build the image
- pip3 install awscli
- IMAGE="709724358365.dkr.ecr.ap-south-1.amazonaws.com/testrepo"
- TAG=latest
- aws configure set aws_access_key_id $AWS_ACCESS_KEY
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
- aws configure set AWS_DEFAULT_REGION $AWS_REGION
- eval $(aws ecr get-login --no-include-email --region ap-south-1 | sed 's;https://;;g')
- docker build -t my-docker-image .
# use the pipe to push the image to AWS ECR
- pipe: atlassian/aws-ecr-push-image:1.5.0
variables:
AWS_DEFAULT_REGION: $AWS_REGION
IMAGE: $IMAGE
TAG: $TAG
AWS_OIDC_ROLE_ARN: 'arn:aws:iam::709724358365:role/ecsdeployrole'
IMAGE_NAME: my-docker-image
- step:
oidc: true
script:
- pipe: atlassian/aws-ecs-deploy:1.6.2
variables:
AWS_DEFAULT_REGION: $AWS_REGION
AWS_OIDC_ROLE_ARN: 'arn:aws:iam::709724358365:role/ecsdeployrole'
CLUSTER_NAME: 'myappcluster'
SERVICE_NAME: 'testapp-service'
TASK_DEFINITION: 'task-definition.json'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Venkat P . I think this is not necessary:
"""
- pip3 install awscli
- IMAGE="709724358365.dkr.ecr.ap-south-1.amazonaws.com/testrepo"
- TAG=latest
- aws configure set aws_access_key_id $AWS_ACCESS_KEY
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
- aws configure set AWS_DEFAULT_REGION $AWS_REGION
- eval $(aws ecr get-login --no-include-email --region ap-south-1 | sed 's;https://;;g')
"""
Just:
"""
- docker build -t my-docker-image .
# use the pipe to push the image to AWS ECR
- pipe: atlassian/aws-ecr-push-image:1.5.0
... and so on
"""
According to your error:
Error: Docker push error: EOF , seems like you don't have ECR repository, check prerequisites in aws-ecr-push-image 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.
@Venkat P some info. If you had setup AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY, AWS_REGION as Repository variables, the pipe will automatically use them according to: https://bitbucket.org/atlassian/aws-ecr-push-image/src/12710693b00ae7438763a360359d5b41b3de0135/pipe.yml#lines-6
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.