Skip to content

Commit

Permalink
Add new helper scripts for parsing YAML files
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Jackson committed Dec 12, 2023
1 parent 2c4703a commit df0ccb4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/determine-main-clustergroup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

PATTERN_DIR="$1"

if [ -z "$PATTERN_DIR" ]; then
PATTERN_DIR="."
fi

CGNAME=$(yq '.main.clusterGroupName' "$PATTERN_DIR/values-global.yaml")

if [ -z "$CGNAME" ] || [ "$CGNAME" == "null" ]; then
echo "Error - cannot detrmine clusterGroupName"
exit 1
fi

echo "$CGNAME"
15 changes: 15 additions & 0 deletions scripts/determine-pattern-name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

PATTERN_DIR="$1"

if [ -z "$PATTERN_DIR" ]; then
PATTERN_DIR="."
fi

PATNAME=$(yq '.global.pattern' "$PATTERN_DIR/values-global.yaml" 2>/dev/null)

if [ -z "$PATNAME" ] || [ "$PATNAME" == "null" ]; then
PATNAME="$(basename "$PWD")"
fi

echo "$PATNAME"

0 comments on commit df0ccb4

Please sign in to comment.