Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Update deploy.sh to retrieve restricted images from AWS ECR (#3410)

Dennis Kuijsb2f536d4064d
diff --git a/.ci_cd/README.md b/.ci_cd/README.md
index 9e948e641..69407d51b 100644
--- a/.ci_cd/README.md
+++ b/.ci_cd/README.md
@@ -120,6 +120,8 @@ Standard variables:
- `AWS_KEY` - AWS access key ID (should be prefixed with `_TEMP_`
- `AWS_SECRET` - AWS access key secret
- `AWS_REGION` - AWS region to use
+- `OR_AWS_ECR_ACCOUNT_ID` - AWS Account ID associated with the ECR repository
+- `OR_AWS_ECR_REGION` - AWS Region where the ECR repository is located
- `OR_ADMIN_PASSWORD` - Admin password to be set on deployment; sets the OR_ADMIN_PASSWORD env variable
- `ENV_COMPOSE_FILE` - The full path to the docker compose file to use for the deployment
- `SKIP_HOST_PING` - Will skip host ping check before deploying (default: false)
diff --git a/.ci_cd/deploy.sh b/.ci_cd/deploy.sh
index b11d955cd..f6642cd20 100644
--- a/.ci_cd/deploy.sh
+++ b/.ci_cd/deploy.sh
@@ -100,7 +100,7 @@ fi
if [ "$SKIP_SSH_WHITELIST" != 'true' ] && [ -n "$AWS_ACCESS_KEY_ID" ]; then
echo "Granting AWS SSH access to github runner"
-
+
source temp/aws/login.sh
if [ -n "$CIDR" ]; then
@@ -219,6 +219,9 @@ if [ -f "temp/deployment.tar.gz" ]; then
docker load < temp/deployment.tar.gz
fi
+# Login to Private ECR Registry to download restricted images
+aws ecr get-login-password --region $OR_AWS_ECR_REGION | docker login --username AWS --password-stdin $OR_AWS_ECR_ACCOUNT_ID.dkr.ecr.$OR_AWS_ECR_REGION.amazonaws.com &>/dev/null
+
# Make sure we have correct keycloak, proxy and postgres images
echo "Pulling requested service versions from docker hub"
docker-compose -p or -f temp/docker-compose.yml pull --ignore-pull-failures
@@ -360,6 +363,9 @@ if [ -f "temp/deployment.tar.gz" ]; then
docker load < temp/deployment.tar.gz
fi
+# Login to Private ECR Registry to download restricted images
+aws ecr get-login-password --region $OR_AWS_ECR_REGION | docker login --username AWS --password-stdin $OR_AWS_ECR_ACCOUNT_ID.dkr.ecr.$OR_AWS_ECR_REGION.amazonaws.com &>/dev/null
+
# Make sure we have correct keycloak, proxy and postgres images
echo "Pulling requested service versions from docker hub"
docker-compose -p or -f temp/docker-compose.yml pull --ignore-pull-failures