Updated Gitlab hook script (markdown)

Jochen Sprickerhof
2018-04-15 09:18:37 +02:00
parent 41039cc18b
commit 8d2b8c1c12

@@ -9,22 +9,23 @@ The script pushes the challenge to the pages git defined in $REPO, waits for it
#
# dehydrated hook script to deploy a key to Gitlab.
#
# https://github.com/lukas2511/dehydrated/wiki/Gitlab-hook-script
#
# Add the following options to your config file:
# TOKEN= API token, generate in Gitlab profile settings (select API access)
# PROJECT= ID or URL-encoded path of the project (replace / with %2F)
# REPO= path to local git repo of your pages project
# TOKEN= # API token, generate in Gitlab profile settings (select API access)
# PROJECT= # ID or URL-encoded path of the project (replace / with %2F)
# REPO= # path to local git repo of your pages project
. "$BASEDIR/$CONFIG"
deploy_challenge() {
DOMAIN="$1"
TOKEN_FILENAME="$2"
cd "$REPO"
mkdir -p public/.well-known/acme-challenge
cp "$WELLKNOWN/$TOKEN_FILENAME" public/.well-known/acme-challenge/
git add public/.well-known/acme-challenge/"$TOKEN_FILENAME"
git commit -m "Let's Encrypt challenge"
git push
mkdir -p "$REPO/public/.well-known/acme-challenge"
cp "$WELLKNOWN/$TOKEN_FILENAME" "$REPO/public/.well-known/acme-challenge/"
git -C "$REPO" add public/.well-known/acme-challenge/"$TOKEN_FILENAME"
git -C "$REPO" commit -m "Let's Encrypt challenge"
git -C "$REPO" push
sleep 20
while ! curl --output /dev/null --silent --head --fail "http://$DOMAIN/.well-known/acme-challenge/$TOKEN_FILENAME"; do
echo sleeping
@@ -34,11 +35,11 @@ deploy_challenge() {
clean_challenge() {
TOKEN_FILENAME="$2"
cd "$REPO"
git reset --hard HEAD~
git push --force-with-lease
git -C "$REPO" reset --hard HEAD~
git -C "$REPO" push --force-with-lease
}
# https://docs.gitlab.com/ee/api/pages_domains.html
deploy_cert() {
DOMAIN="$1"
KEYFILE="$2"