Add support for SSH git URLs

This commit is contained in:
2023-08-31 19:00:16 +02:00
parent 11edf32c68
commit 30fe61c9c0
4 changed files with 20 additions and 3 deletions

10
init/check-ssh.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/bin/bash
SSH_GIT_URL_REGEX="^ssh:\/\/([^@]+@)?([a-z0-9\-\.]+)[:/].*$"
if [[ "$REPO_URL" =~ $SSH_GIT_URL_REGEX ]]; then
echo "Detected SSH repo URL, importing host key"
ssh-keyscan ${BASH_REMATCH[2]} >> /root/.ssh/known_hosts || exit 1
fi
/aux/pull-n-build.sh || exit 1

15
init/cron.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
# stop on error
set -e
if [ "$BUILDFREQ" == "" ]; then
# set default
BUILDFREQ=10
fi
# Run the pull script regularly
echo "$BUILDFREQ * * * * /aux/pull-n-build.sh" >> /var/spool/cron/crontabs/root
# start cron daemon (goes into background)
crond