Skip to content

armgit / core

Public Imported from GitHub
0

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

CI/CD: minor

Rich Turnere13ecfc23f89
diff --git a/.ci_cd/aws/provision_host.sh b/.ci_cd/aws/provision_host.sh
index 93812519e..21a7fd30e 100644
--- a/.ci_cd/aws/provision_host.sh
+++ b/.ci_cd/aws/provision_host.sh
@@ -43,7 +43,7 @@ else
fi
# Optionally login if AWS_ENABLED != 'true'
-source "${awsDir}login.sh"
+#source "${awsDir}login.sh"
ACCOUNT_PROFILE=
if [ -n "$ACCOUNT_NAME" ]; then
@@ -55,7 +55,7 @@ fi
STACK_NAME=$(tr '.' '-' <<< "$HOST")
# Check stack doesn't already exist
-STATUS=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].StackStatus" --output text $ACCOUNT_PROFILE 2>/dev/null)
+#STATUS=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].StackStatus" --output text $ACCOUNT_PROFILE 2>/dev/null)
if [ -n "$STATUS" ] && [ "$STATUS" != 'DELETE_COMPLETE' ]; then
echo "Stack already exists for this host '$HOST' current status is '$STATUS'"
@@ -78,7 +78,11 @@ else
if [ -n "$ACCOUNT_PROFILE" ]; then
# Append caller account hosted zones
- HOSTED_ZONES=$(aws route53 list-hosted-zones --query "HostedZones[?contains(Name, '$TLD_NAME.')].[Name,'true']" --output text)
+ read -r -d '' HOSTED_ZONES << EOF
+$HOSTED_ZONES
+$(aws route53 list-hosted-zones --query "HostedZones[?contains(Name, '$TLD_NAME.')].[Name,'true']" --output text)
+EOF
+ echo "$HOSTED_ZONES"
fi
if [ -n "$HOSTED_ZONES" ]; then
@@ -106,10 +110,15 @@ else
exit 1
fi
fi
+ break
fi
done
- i=$(($i+1))
+ if [ -n "$DNSHostedZoneName" ]; then
+ break
+ fi
+
+ i=$((i+1))
done
fi
@@ -119,7 +128,7 @@ else
if [ -n "$DNSHostedZoneRoleArn" ]; then
PARAMS="$PARAMS ParameterKey=DNSHostedZoneRoleArn,ParameterValue=$DNSHostedZoneRoleArn"
fi
-
+exit 1
# Create standard stack resources in specified account
STACK_ID=$(aws cloudformation create-stack --capabilities CAPABILITY_NAMED_IAM --stack-name $STACK_NAME --template-body file://$TEMPLATE_PATH --parameters $PARAMS --output text $ACCOUNT_PROFILE)
diff --git a/.ci_cd/deploy.sh b/.ci_cd/deploy.sh
index 2d71cb273..0bd89cae8 100644
--- a/.ci_cd/deploy.sh
+++ b/.ci_cd/deploy.sh
@@ -208,6 +208,7 @@ $sshCommandPrefix ${hostStr} << EOF
if [ "$ROLLBACK_ON_ERROR" == 'true' ]; then
echo "Moving old temp dir to temp_old"
+ rm -fr temp_old
mv temp temp_old
# Tag existing manager image with previous tag (current tag might not be available in docker hub anymore or it could have been overwritten)
docker tag `docker images openremote/manager -q | head -1` openremote/manager:previous
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index dd5f4a854..5cf144f07 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -692,12 +692,21 @@ jobs:
os.system(f"cat .ci_cd/env/{env}.env >> temp/env")
# Output inputs and secrets (spacial handling for SSH_KEY and SSH_PASSWORD)
- # _ENV_ prefixed keys are output last (to override any non env specific keys)
+ # _$ENV_ prefixed keys are output last (to override any non env specific keys)
+ # some sensitive secrets are excluded
for key, value in inputsAndSecrets.items():
if "." in key:
continue
if key.startswith("_"):
continue
+ if key == "AWS_SECRET_ACCESS_KEY":
+ continue
+ if key == "AWS_ACCESS_KEY_ID":
+ continue
+ if key == "DOCKERHUB_PASSWORD":
+ continue
+ if key == "github_token":
+ continue
os.system(f"echo 'Secret found {key}...'")
if key == "SSH_KEY":
os.system(f"echo \"{value}\" > ssh.key")
@@ -716,6 +725,14 @@ jobs:
continue
if not key.startswith("_"):
continue
+ if key == "AWS_SECRET_ACCESS_KEY":
+ continue
+ if key == "AWS_ACCESS_KEY_ID":
+ continue
+ if key == "DOCKERHUB_PASSWORD":
+ continue
+ if key == "github_token":
+ continue
environment = (env if env else "").upper()
prefix = "_" + environment + "_"
if not key.startswith(prefix):