Skip to content

Commit eb27432

Browse files
author
Matthew Fisher
committed
fix(builder): exit if response is bad
1 parent cab5d76 commit eb27432

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

builder/templates/builder

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ RESPONSE=$(curl -s -XPOST \
9494
$URL)
9595

9696
# massage response for the environment variables in form HELLO=world
97-
CONFIG=$(echo $RESPONSE | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["values"]' | jq -c -M "to_entries|map(\"\(.key)=\(.value|tostring)\")|.[]")
97+
CONFIG=$(echo $RESPONSE | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["values"]' | jq -c -M "to_entries|map(\"\(.key)=\(.value|tostring)\")|.[]" || echo $RESPONSE)
98+
99+
if [ "$CONFIG" == "$RESPONSE" ];
100+
then
101+
echo $RESPONSE
102+
exit 1
103+
fi
98104

99105
# build option string to send to slugbuilder
100106
BUILD_OPTS=""
@@ -165,7 +171,14 @@ RESPONSE=$(curl -s -XPOST \
165171
--data "$DATA" \
166172
$URL)
167173

168-
RELEASE=$(echo $RESPONSE | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["release"]["version"]')
174+
RELEASE=$(echo $RESPONSE | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["release"]["version"]' || echo $RESPONSE)
175+
176+
if [ "$RELEASE" == "$RESPONSE" ];
177+
then
178+
echo $RESPONSE
179+
exit 1
180+
fi
181+
169182
DOMAIN=$(echo $RESPONSE | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["domains"][0]')
170183
echo "done, v$RELEASE"
171184
puts-step "$APP_NAME deployed to Deis"

0 commit comments

Comments
 (0)