Skip to content

Commit

Permalink
Merge pull request #205 from wunderio/pullsecrets
Browse files Browse the repository at this point in the history
Enable environment variable overriding
  • Loading branch information
Rade333 authored Oct 15, 2024
2 parents bfbaff2 + 7b68204 commit f3e09c4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions orb/commands/@common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,23 @@ docker-setup:
steps:
- setup_remote_docker

environment-variable-override:
description: "Override environment variables based on cluster id."
steps:
- run:
name: Environment variable override
command: |
if [ ! -z "${SILTA_CLUSTER_ID}" ]; then
# iterate variables starting with "${SILTA_CLUSTER_ID}_"
for var in $(compgen -A variable | grep "^${SILTA_CLUSTER_ID}_"); do
# if value is not empty and target value differs from the source value, set it as environment variable
if [ ! -z "${!var}" ] && [ "${!var}" != "${var/${SILTA_CLUSTER_ID}_/}" ]; then
export ${var/${SILTA_CLUSTER_ID}_/}="${!var}"
echo "export ${var/${SILTA_CLUSTER_ID}_/}='${!var}'" >> "$BASH_ENV"
fi
done
fi
silta-setup:
description: "Set up silta cluster connection and set release name."
parameters:
Expand All @@ -133,6 +150,7 @@ silta-setup:
type: string
default: ''
steps:
- environment-variable-override
- set-up-socks-proxy
- cloud-login
- docker-login
Expand Down Expand Up @@ -207,6 +225,7 @@ cloud-login:
-d "rbac_reload_key=${SILTA_DASHBOARD_KEY}" \
-d "cluster=${SILTA_CLUSTER_ID}" \
-d "namespace=${NAMESPACE}"
echo ""
echo "Credentials requested, please rerun the build."
fi
exit 1
Expand Down

0 comments on commit f3e09c4

Please sign in to comment.