From 0bfacedc9683225b0bd939d58844e554985e1812 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Sun, 11 Aug 2019 10:41:49 +0200 Subject: [PATCH] curl follow Gitlab redirect, silent deploy, better status message --- Gitlab-hook-script.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gitlab-hook-script.md b/Gitlab-hook-script.md index 14b279d..b800351 100644 --- a/Gitlab-hook-script.md +++ b/Gitlab-hook-script.md @@ -27,8 +27,8 @@ deploy_challenge() { git -C "$REPO" commit -m "Let's Encrypt challenge" git -C "$REPO" push sleep 20 - while ! curl --output /dev/null --silent --head --fail "https://$DOMAIN/.well-known/acme-challenge/$TOKEN_FILENAME"; do - echo sleeping + while ! curl --output /dev/null --silent --head --location --fail "https://$DOMAIN/.well-known/acme-challenge/$TOKEN_FILENAME"; do + echo "Waiting for challenge to be deployed" sleep 5 done } @@ -45,7 +45,7 @@ deploy_cert() { DOMAIN="$1" KEYFILE="$2" FULLCHAINFILE="$4" - curl --request PUT --header "PRIVATE-TOKEN: $TOKEN" --form "certificate=@$FULLCHAINFILE" --form "key=@$KEYFILE" "https://gitlab.com/api/v4/projects/$PROJECT/pages/domains/$DOMAIN" + curl --output /dev/null --silent --fail --request PUT --header "PRIVATE-TOKEN: $TOKEN" --form "certificate=@$FULLCHAINFILE" --form "key=@$KEYFILE" "https://gitlab.com/api/v4/projects/$PROJECT/pages/domains/$DOMAIN" } HANDLER="$1"; shift