Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
fix(builder): exit if response is bad
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Fisher committed Oct 6, 2014
1 parent cab5d76 commit eb27432
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions builder/templates/builder
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ RESPONSE=$(curl -s -XPOST \
$URL)

# massage response for the environment variables in form HELLO=world
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)\")|.[]")
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)

if [ "$CONFIG" == "$RESPONSE" ];
then
echo $RESPONSE
exit 1
fi

# build option string to send to slugbuilder
BUILD_OPTS=""
Expand Down Expand Up @@ -165,7 +171,14 @@ RESPONSE=$(curl -s -XPOST \
--data "$DATA" \
$URL)

RELEASE=$(echo $RESPONSE | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["release"]["version"]')
RELEASE=$(echo $RESPONSE | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["release"]["version"]' || echo $RESPONSE)

if [ "$RELEASE" == "$RESPONSE" ];
then
echo $RESPONSE
exit 1
fi

DOMAIN=$(echo $RESPONSE | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["domains"][0]')
echo "done, v$RELEASE"
puts-step "$APP_NAME deployed to Deis"
Expand Down

0 comments on commit eb27432

Please sign in to comment.