check if clone was successful

This commit is contained in:
Michael Grote 2023-08-15 10:14:35 +02:00
parent 2094cd7567
commit 7107e3d999

14
app.sh
View file

@ -1,12 +1,10 @@
#!/bin/bash
GIT_REPO_PATH=$(mktemp -d)
GIT_REPO_PATH=$(mktemp -d)
git config --global user.email "$GIT_USER_MAIL"
git config --global user.name "$GIT_USERNAME"
git config --global user.email "$GIT_USER_MAIL"
git config --global user.name "$GIT_USERNAME"
echo "[INFO] clone repository..."
GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet > /dev/null
echo "[INFO] check variables..."
if [ -z "$GIT_REPO_DEPLOY_KEY" ] ; then
echo "[ERROR] \$GIT_REPO_DEPLOY_KEY is not set."
@ -41,7 +39,13 @@ if [ -z "$DEVICES" ] ; then
exit 3
fi
echo "[INFO] clone repository..."
if GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet > /dev/null; then
cd "$GIT_REPO_PATH" || exit
else
echo "[ERROR] Failed to clone repository."
exit 1
fi
while true ; do
echo "[INFO] pull repository..."