Netlify: leverage --fail-with-body to finally print error's output

Signed-off-by: Guillaume de Rouville <guillaume.derouville@gmail.com>
This commit is contained in:
Guillaume de Rouville 2021-06-30 10:03:42 +02:00 committed by Tom Chauveau
parent 535bbb68fb
commit e3eee6068e
2 changed files with 5 additions and 4 deletions

View File

@ -6,16 +6,17 @@ package netlify
create_site() { create_site() {
url="https://api.netlify.com/api/v1/${NETLIFY_ACCOUNT:-}/sites" url="https://api.netlify.com/api/v1/${NETLIFY_ACCOUNT:-}/sites"
response=$(curl -s -S -f -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \ response=$(curl -s -S --fail-with-body -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
-X POST -H "Content-Type: application/json" \ -X POST -H "Content-Type: application/json" \
$url \ $url \
-d "{\"name\": \"${NETLIFY_SITE_NAME}\", \"custom_domain\": \"${NETLIFY_DOMAIN}\"}" -d "{\"name\": \"${NETLIFY_SITE_NAME}\", \"custom_domain\": \"${NETLIFY_DOMAIN}\"}" -o body
) )
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cat body >&2
exit 1 exit 1
fi fi
echo $response | jq -r '.site_id' cat body | jq -r '.site_id'
} }
site_id=$(curl -s -S -f -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \ site_id=$(curl -s -S -f -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \

View File

@ -22,7 +22,7 @@ TestNetlify: {
// Deploy to netlify // Deploy to netlify
deploy: #Site & { deploy: #Site & {
contents: html contents: html
name: "dagger-test" name: "dagger-test-\(data.out)"
} }
// Check if the deployed site has the random marker // Check if the deployed site has the random marker