allow to run without checking out a repository

This commit is contained in:
Simon Belmas
2024-07-29 17:55:15 +02:00
parent 9efb2a0a15
commit 0b156f5b48
2 changed files with 25 additions and 10 deletions

View File

@@ -1,19 +1,23 @@
#!/bin/sh
git_retries=20
try=0
export GIT_SSH_COMMAND='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
until timeout 10 git clone --recurse-submodules ${CONTENT_GIT_REPO} /app ; do
echo "Retry git pull after error ($try / $git_retries)"
try=$((try+1))
if [ $try -eq $git_retries ]; then
exit 1
fi
sleep 1
done
if [ -n "${CONTENT_GIT_REPO}" ] ; then
export GIT_SSH_COMMAND='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
until timeout 10 git clone --recurse-submodules ${CONTENT_GIT_REPO} /app ; do
echo "Retry git pull after error ($try / $git_retries)"
try=$((try+1))
if [ $try -eq $git_retries ]; then
exit 1
fi
sleep 1
done
fi
cd /app
if [ -e index.html ] ; then
mv index.html index-embedded.html
fi
cat <<EOF >index.html
<html>
<head>
@@ -24,15 +28,26 @@ cat <<EOF >index.html
From node ${KUBE_NODE_NAME}<br />
as <a href="./kube-node.json">json</a> - <a href="./kube-node.txt">text</a>
</p>
EOF
if [ -n "${CONTENT_GIT_REPO}" ] ; then
cat <<EOF >>index.html
<iframe
id="embeddedcontent"
title="embeddedcontent"
width="100%"
height="90%"
src="./index-embedded.html" />
EOF
fi
cat <<EOF >>index.html
</body>
</html>
EOF
ls -l
cat index.html
echo '{"node": "'${KUBE_NODE_NAME}'"}' > kube-node.json
echo -n ${KUBE_NODE_NAME} > kube-node.txt