Skip to content

Commit 0e76e56

Browse files
committed
bin: terminate ssh socket when push-production aborts
1 parent a2d9eb5 commit 0e76e56

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ Der Workflow speichert die generierten Seiten im `live` branch des Repositories,
7878
welcher nach Benachrichtigung durch einen Webhook von [caddy](./Caddyfile) gepullt wird.
7979

8080
Bei Änderungen am Caddyfile oder dem Docker image
81-
muss [push-production.sh](./bin/push-production.sh) mit dem GITHUB_SECRET des Webhooks ausgeführt werden.
81+
muss [push-production.sh](./bin/push-production.sh) mit dem GITHUB_SECRET des Webhooks ausgeführt werden
82+
(bei credential-abfrage beliebigen Text eingeben).
8283
Der Docker container lässt sich auch lokal mit [test-production.sh](./bin/test-production.sh) testen,
8384
wobei der Caddy Webserver auf port 80 via [localhost](http://localhost) erreichbar wird.
8485

bin/push-production.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@ port=8200
55

66
if test -z "$GITHUB_SECRET"; then
77
echo "No github secret set. Start with GITHUB_SECRET=<some secret>, or enter below."
8-
LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c32 | cat
9-
echo ""
8+
#LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c32 | cat
9+
#echo ""
1010
read -r -p 'GitHub secret to use: ' GITHUB_SECRET
1111
fi
1212

13+
1314
ssh -M -S /tmp/ssh-ctrl-socket -fnNT -L 5000:localhost:5000 $server
15+
onkill() { ssh -S /tmp/ssh-ctrl-socket -O exit $server; }
16+
trap onkill SIGTERM
17+
1418
ssh -S /tmp/ssh-ctrl-socket -O check $server || exit 1
1519
docker login localhost:5000 || exit 1
1620

0 commit comments

Comments
 (0)