The deployment script I use for this site, is more ment to protect me, from myself, a safety net. Well, I found a hole on that net.
Turns out, I didn’t a have catch, for if Hugo failed to build my site. So when Hugo failed due to a missing closing quote in a file, the script just kept going. And so, rsync, nuked my website on my web host. Thankfully, I caught it pretty quick, and threw my site into maintenance mode.
I found the missing quote, added it, and redeployed my site. Once that was done, I turned maintenance mode off, and everything was good again.
Fixing The Net
Alright, this needs to be fixed. A simple check in my script is all I need.
if [ $? -ne 0 ]; then
echo ""
echo "Hugo build failed. Exiting."
exit 1
fi
Tossing that after the Hugo command, it should be good.
Now, I’m not just going to trust that this will work, I need to test it. Firing up a test site on NFSN, I did just that. Removing the same quote, and letting it rip.
The script stopped before the rsync section, and my test site was still up. Perfect.
My deployment script is ment to protect me, from myself. Deploying my site is just something it does on the side.