Last active
October 26, 2016 22:24
-
-
Save ttrahan/ab0f4964aec5544683dc6731cdaea133 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract params data | |
# replace "params-tfScripts" in line 5 with the name of your params resource | |
echo -e "\n*** extracting params information ***" | |
get_params() { | |
local PARAMS_FILE="./IN/$1/version.json" | |
if [ -f "$PARAMS_FILE" ]; then | |
PARAMS_VALUES=$(jq -r '.version.propertyBag.params' $PARAMS_FILE) | |
PARAMS_LENGTH=$(echo $PARAMS_VALUES | jq '. | length') | |
PARAMS_KEYS=$(echo $PARAMS_VALUES | jq '. | keys') | |
for (( i=0; i<$PARAMS_LENGTH; i++ )) do | |
PARAM_KEY=$(echo $PARAMS_KEYS | jq -r .[$i]) | |
export $PARAM_KEY=$(echo $PARAMS_VALUES | jq -r .[\"$PARAM_KEY\"]) | |
done | |
echo "loaded params file" | |
else | |
echo "no params file exists" | |
fi | |
} | |
get_params $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment