check if clone was successful

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

8
app.sh
View file

@ -5,8 +5,6 @@
git config --global user.email "$GIT_USER_MAIL" git config --global user.email "$GIT_USER_MAIL"
git config --global user.name "$GIT_USERNAME" 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..." echo "[INFO] check variables..."
if [ -z "$GIT_REPO_DEPLOY_KEY" ] ; then if [ -z "$GIT_REPO_DEPLOY_KEY" ] ; then
echo "[ERROR] \$GIT_REPO_DEPLOY_KEY is not set." echo "[ERROR] \$GIT_REPO_DEPLOY_KEY is not set."
@ -41,7 +39,13 @@ if [ -z "$DEVICES" ] ; then
exit 3 exit 3
fi 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 cd "$GIT_REPO_PATH" || exit
else
echo "[ERROR] Failed to clone repository."
exit 1
fi
while true ; do while true ; do
echo "[INFO] pull repository..." echo "[INFO] pull repository..."