Skip to content

Commit

Permalink
Merge pull request #148 from mintel/tanka-env-label
Browse files Browse the repository at this point in the history
Fix env var name conflict in Tanka render script
  • Loading branch information
jtdoepke authored Apr 7, 2023
2 parents 6f8d6e2 + 2b37729 commit 6926db5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/k8s/tanka/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ while (( "$#" )); do
case "$1" in
-a|--app)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
APP=$2
TANKA_LABEL_APP=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
Expand All @@ -18,7 +18,7 @@ while (( "$#" )); do
;;
-e|--env)
if [ -n "$2" ] && [ "${2:0:1}" != "-" ]; then
ENV=$2
TANKA_LABEL_ENV=$2
shift 2
else
echo "Error: Argument for $1 is missing" >&2
Expand All @@ -38,15 +38,15 @@ done
eval set -- "$PARAMS"

SELECTOR=()
if [ -n "$APP" ]; then
SELECTOR+=( "app in ($APP)" )
if [ -n "$TANKA_LABEL_APP" ]; then
SELECTOR+=( "app in (${TANKA_LABEL_APP})" )
fi

if [ -n "$ENV" ]; then
SELECTOR+=( "env in ($ENV)" )
if [ -n "$TANKA_LABEL_ENV" ]; then
SELECTOR+=( "env in (${TANKA_LABEL_ENV})" )
fi

if [ "$ENV" != "local" ]; then
if [ "$TANKA_LABEL_ENV" != "local" ]; then
SELECTOR+=( "env!=local" )
fi

Expand Down Expand Up @@ -86,7 +86,7 @@ touch "$(pwd)/rendered/.gitkeep"
err=$(tk env list environments --names -l "$(join_arr , "${SELECTOR[@]}")" 2>&1 | grep -v TRACE) && rc=$? || rc=$?
if [[ $rc != 0 ]]; then
echo "$err"
exit $rc
exit "$rc"
fi

# Delete the manifests for each environment as these will be re-generated
Expand Down

0 comments on commit 6926db5

Please sign in to comment.