From 4fd4b0bc5611fdae0623a421814868f484dbf3e0 Mon Sep 17 00:00:00 2001 From: Rustie Lin Date: Thu, 17 Mar 2022 11:02:16 -0700 Subject: [PATCH] [circleci] fix main image tag when exists Closes: #230 --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a1cc7fab9ecbc..e2cfe5cbc4f3e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,7 +82,10 @@ jobs: for img in "${imgs[@]}" do MANIFEST=$(aws ecr batch-get-image --repository-name aptos/${img} --image-ids imageTag=$IMAGE_TAG --query 'images[].imageManifest' --output text) - aws ecr put-image --repository-name aptos/${img} --image-tag main --image-manifest "$MANIFEST" || ret=$? + put_img_out=$(aws ecr put-image --repository-name aptos/${img} --image-tag main --image-manifest "$MANIFEST" 2>&1) + ret=$? + # ok if image tag exists and cannot overwrite + echo $put_img_out | grep 'ImageAlreadyExistsException' && ret=0 done exit $ret fi