Skip to content

armgit / core

Public Imported from GitHub
0

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

Minor

Rich Turner0c3ec48761b3
diff --git a/.ci_cd/deploy.sh b/.ci_cd/deploy.sh
index 48ad94344..0594ca925 100644
--- a/.ci_cd/deploy.sh
+++ b/.ci_cd/deploy.sh
@@ -41,11 +41,11 @@ if [ -z "$OR_HOSTNAME" ]; then
fi
HOST="$OR_HOSTNAME"
-# Load SSH environment variables into this session
-if [ -f "ssh.env" ]; then
- echo "Loading SSH password environment variable: 'ssh.env'"
+# Load temp environment variables into this session
+if [ -f "temp.env" ]; then
+ echo "Loading SSH password environment variable: 'temp.env'"
set -a
- . ./ssh.env
+ . ./temp.env
set +x
fi
@@ -62,8 +62,7 @@ if [ -d ".ci_cd/aws" ]; then
cp -r .ci_cd/aws temp/
fi
-chmod +x temp/aws/*
-chmod +x temp/host_int/*
+chmod -R +rx temp/
# Determine compose file to use and copy to temp dir (do this here as all env variables are loaded)
if [ -z "$ENV_COMPOSE_FILE" ]; then
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 5cf144f07..fc3f77238 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -691,66 +691,39 @@ jobs:
os.system(f"echo 'Outputting .ci_cd/env/{env}.env to temp/env'")
os.system(f"cat .ci_cd/env/{env}.env >> temp/env")
- # Output inputs and secrets (spacial handling for SSH_KEY and SSH_PASSWORD)
+ # Output inputs and secrets (spacial handling for SSH_KEY and some other variables)
# _$ENV_ prefixed keys are output last (to override any non env specific keys)
- # some sensitive secrets are excluded
+ environment = (env if env else "").upper()
+ prefix = "_" + environment + "_"
+
for key, value in inputsAndSecrets.items():
if "." in key:
continue
+
+ # Look for env prefixed keys
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")
- elif key == "SSH_PASSWORD":
- os.system(f"echo '{key}=\"{value}\"' > ssh.env")
- else:
- lines = len(value.split("\n"))
- if lines > 1:
- os.system(f"echo '{key}=\"' >> temp/env")
- os.system(f"echo '{value}\"' >> temp/env")
+ if key.startswith(prefix):
+ key = key.replace(prefix, "")
else:
- os.system(f"echo '{key}=\"{value}\"' >> temp/env")
-
- for key, value in inputsAndSecrets.items():
- if "." in key:
- continue
- if not key.startswith("_"):
- continue
- if key == "AWS_SECRET_ACCESS_KEY":
- continue
- if key == "AWS_ACCESS_KEY_ID":
- continue
+ continue
+
if key == "DOCKERHUB_PASSWORD":
continue
if key == "github_token":
continue
- environment = (env if env else "").upper()
- prefix = "_" + environment + "_"
- if not key.startswith(prefix):
- continue
- else:
- key = key.replace(prefix, "")
- os.system(f"echo 'Secret found {key}...'")
- if key == "SSH_KEY":
- os.system(f"echo \"{value}\" > ssh.key")
- elif key == "SSH_PASSWORD":
- os.system(f"echo '{key}=\"{value}\"' > ssh.env")
- else:
- lines = len(value.split("\n"))
- if lines > 1:
- os.system(f"echo '{key}=\"' >> temp/env")
- os.system(f"echo '{value}\"' >> temp/env")
+ else:
+ os.system(f"echo 'Secret found {key}...'")
+ if key == "SSH_KEY":
+ os.system(f"echo \"{value}\" > ssh.key")
+ elif key == "SSH_PASSWORD" or key == "AWS_ACCESS_KEY_ID" or key == "AWS_SECRET_ACCESS_KEY":
+ os.system(f"echo '{key}=\"{value}\"' > temp.env")
else:
- os.system(f"echo '{key}=\"{value}\"' >> temp/env")
+ lines = len(value.split("\n"))
+ if lines > 1:
+ os.system(f"echo '{key}=\"' >> temp/env")
+ os.system(f"echo '{value}\"' >> temp/env")
+ else:
+ os.system(f"echo '{key}=\"{value}\"' >> temp/env")
# Set CIDR environment variable
if ipv4 is not None and ipv4 != '':