From aa806bbd55b1373a323b620c8ce896da742bfdc6 Mon Sep 17 00:00:00 2001 From: Bruno Carvalho Date: Wed, 28 Jun 2023 14:35:45 +0100 Subject: [PATCH 1/4] PLATSD-188 ditto to ECR --- .pre.yml | 2 +- docker/docker-compose.yml | 2 +- docker/scripts/utils.sh | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pre.yml b/.pre.yml index 73af4fb..73db9c1 100644 --- a/.pre.yml +++ b/.pre.yml @@ -10,7 +10,7 @@ jobs: variable: DOCKER_PASSWORD commands: - docker login -u lokalise -p ${DOCKER_PASSWORD} reg.lokalise.work - - docker build -f docker/Dockerfile -t reg.lokalise.work/ce-connector-ditto/app:PRE-{{.PR}} . + - docker build -f docker/Dockerfile -t 053497547689.dkr.ecr.eu-central-1.amazonaws.com/ce-connector-ditto/app:PRE-{{.PR}} -t reg.lokalise.work/ce-connector-ditto/app:PRE-{{.PR}} . - docker push reg.lokalise.work/ce-connector-ditto/app:PRE-{{.PR}} - name: deploy-{{.PR}} diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 4e05fbf..0092498 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,3 +1,3 @@ services: app: - image: reg.lokalise.work/ce-connector-ditto/app:${TAG} + image: 053497547689.dkr.ecr.eu-central-1.amazonaws.com/ce-connector-ditto/app:${TAG} diff --git a/docker/scripts/utils.sh b/docker/scripts/utils.sh index 8502a75..a16fe31 100755 --- a/docker/scripts/utils.sh +++ b/docker/scripts/utils.sh @@ -5,6 +5,7 @@ set -o pipefail REQUIRED_EXECUTABLES=(curl docker docker-compose jq vault) DOCKER_ROOT_PATH=${DOCKER_ROOT_PATH:-docker} LOKALISE_REGISTRY="reg.lokalise.work" +LOKALISE_ECR_REGISTRY="053497547689.dkr.ecr.eu-central-1.amazonaws.com" REGISTRY_USER="lokalise" From cad75622a74f120ec9670eec28b4960ff64dd323 Mon Sep 17 00:00:00 2001 From: Bruno Carvalho Date: Wed, 28 Jun 2023 15:01:10 +0100 Subject: [PATCH 2/4] PLATSD-188 add miage retagging on ECR --- docker/scripts/release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/scripts/release.sh b/docker/scripts/release.sh index dddf8cc..cbafc17 100755 --- a/docker/scripts/release.sh +++ b/docker/scripts/release.sh @@ -25,9 +25,9 @@ create_git_tag() { } retag_and_push_image() { - IMAGE="${LOKALISE_REGISTRY}/${GIT_REPO_NAME}/${APP_NAME}" + IMAGE="${LOKALISE_ECR_REGISTRY}/${GIT_REPO_NAME}/${APP_NAME}" - log "Retaging image with ${IMAGE}:${TAG}" + log "Retaging ECR image with ${IMAGE}:${TAG}" docker pull ${IMAGE}:PRE-${GIT_BASE_BRANCH} docker tag ${IMAGE}:PRE-${GIT_BASE_BRANCH} ${IMAGE}:${TAG} From d481771720acafb874529f002f1db0506a83601f Mon Sep 17 00:00:00 2001 From: Bruno Carvalho Date: Wed, 28 Jun 2023 15:18:19 +0100 Subject: [PATCH 3/4] PLATSD-188 push to ECR --- .pre.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre.yml b/.pre.yml index 73db9c1..5c9de41 100644 --- a/.pre.yml +++ b/.pre.yml @@ -12,6 +12,7 @@ jobs: - docker login -u lokalise -p ${DOCKER_PASSWORD} reg.lokalise.work - docker build -f docker/Dockerfile -t 053497547689.dkr.ecr.eu-central-1.amazonaws.com/ce-connector-ditto/app:PRE-{{.PR}} -t reg.lokalise.work/ce-connector-ditto/app:PRE-{{.PR}} . - docker push reg.lokalise.work/ce-connector-ditto/app:PRE-{{.PR}} + - docker push 053497547689.dkr.ecr.eu-central-1.amazonaws.com/ce-connector-ditto/app:PRE-{{.PR}} - name: deploy-{{.PR}} node: ditto-{{.PR}} From e6f45a966394cb4e1479701557c30fee54fb84d8 Mon Sep 17 00:00:00 2001 From: Bruno Carvalho Date: Wed, 28 Jun 2023 15:23:17 +0100 Subject: [PATCH 4/4] PLATSD-188 separate push to ecr function --- docker/scripts/release.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docker/scripts/release.sh b/docker/scripts/release.sh index cbafc17..109bce4 100755 --- a/docker/scripts/release.sh +++ b/docker/scripts/release.sh @@ -25,6 +25,18 @@ create_git_tag() { } retag_and_push_image() { + IMAGE="${LOKALISE_REGISTRY}/${GIT_REPO_NAME}/${APP_NAME}" + + log "Retaging image with ${IMAGE}:${TAG}" + + docker pull ${IMAGE}:PRE-${GIT_BASE_BRANCH} + docker tag ${IMAGE}:PRE-${GIT_BASE_BRANCH} ${IMAGE}:${TAG} + docker tag ${IMAGE}:PRE-${GIT_BASE_BRANCH} ${IMAGE}:latest + docker push ${IMAGE}:${TAG} + docker push ${IMAGE}:latest +} + +retag_and_push_image_ecr() { IMAGE="${LOKALISE_ECR_REGISTRY}/${GIT_REPO_NAME}/${APP_NAME}" log "Retaging ECR image with ${IMAGE}:${TAG}" @@ -93,6 +105,7 @@ case ${action} in git_tag) create_git_tag retag_and_push_image + retag_and_push_image_ecr ;; git_release) create_git_release