The automation that has saved me the most time is almost never clever. It is a ten line script that does one thing, runs the same way every time, and that I can read six months later.
A simple rule
Before building anything, ask how often the task happens and how painful it is when it goes wrong. If the answer is rarely and not very, do it by hand.
Start with the direct path
Write the command that solves the problem end to end first. Only wrap it in something bigger once the same need shows up again.
#!/usr/bin/env bash
set -euo pipefail
rsync -av --delete ./site/ server:/var/www/site/
That one line replaced a deploy pipeline I never needed. When it stops being enough, I will know exactly what to add.
Takeaways
- Prefer boring and readable over clever.
- Wait for the second or third repetition before automating.
- Keep tools small enough to throw away.