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

@@ -11,7 +11,7 @@ Ingress fqdn has to be configured by either:
*replicas* and *content-git-repo* in *config* folder can be customized by modifying files or applying kustomize patch *replicas* and *content-git-repo* in *config* folder can be customized by modifying files or applying kustomize patch
Connntent git will be displayed in an iframe with node name on top. Content git will be displayed in an iframe with node name on top. If it's empty, it will display a blank page with node name.
Node name is displayed on the top of the page and also in kube-node.json and on kube-node.txt Node name is displayed on the top of the page and also in kube-node.json and on kube-node.txt

View File

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