CI/CD

I’ve got some time to get back to CI/CD project. At this state I need a way to trigger the update the blog sources from git. For this I create a small shell script that will update the git repo. It listen on port 7777 and triggers a pull.

#!/usr/bin/env bash

echo "[run-updater]: Starting"
test -f /tmp/updater.pid && kill $(cat /tmp/updater.pid) && rm /tmp/updater.pid && echo "[run-updater]: Restart updater"
echo $$ > /tmp/updater.pid
while true; 
do
        echo -e "HTTP/1.1 204 No Content\r\nConnection: close\r\n\r" |   nc -l 0.0.0.0 7777; bash update.sh
done

Next is to run the hugo server

#!/usr/bin/env bash


test -f /tmp/hugo.pid && kill $(cat /tmp/hugo.pid)
#TMP_DIR=$(mktemp -d)

#cd $TMP_DIRS
cd /tmp/
test -d Blog || git clone --recursive ssh://git@git.akendo.eu/akendo/Blog.git

cd Blog
git pull
hugo 
hugo server -D -b $IP --bind $IP & 
pgrep hugo > /tmp/hugo.pid
cd tools
bash run-updater.sh &

Now I can git commit from my phone and trigger it via curl build.akendo.eu 7777 (this is just a example). Next is to create a docker container in which the process is executed. For this I pull an archlinux image and install hugo. Now I need to sync the git sources into the docker container. But I do this tomorrow.

So far,
akendo