Pokhara, NepalUTC+05:45 NPT
Open to conversations

Delivery

The first CI pipeline I could explain

Four steps, pinned versions, and a manual deploy — small enough to debug when it breaks.

4 min read

My first pipeline was too ambitious. It ran tests, built an image, scanned it, deployed it, and sent a notification, all in one job. When it failed, the log was long and the cause was not obvious. I could not explain what each step was for.

I deleted it and rebuilt it with four steps.

The four steps

  1. Set up a pinned language version.
  2. Lint and test the code.
  3. Build and push an image tagged with the commit SHA.
  4. Deploy a specific tag manually.

That is the whole thing. It is slower than a fully automated release and much easier to reason about. When something fails now, I know which of the four steps to open.

Pin the things that move

The first version used ubuntu-latest and the newest version of every tool. A runner update changed the available version of a build tool, and a pipeline that had been green for weeks failed without a code change.

Now the runner image and the language version are explicit, and dependencies come from a lockfile. A build should change because I changed something, not because the platform did.

Secrets are not configuration

I put a database URL in a workflow variable because it was convenient, then had to rotate it when I realised the value was visible to anyone who could read the repository. Credentials belong in secrets, and even then only the ones that are actually needed.

Rollback means a known image

The first rollback attempt was "re-run the pipeline on the previous commit". That builds a new image from old code, which is not the same thing as restoring the image that was running before.

Now every image has a commit tag, and rolling back means deploying the previous tag. It takes a minute and does not depend on the build system behaving the same way it did last week.

Keep it boring

A pipeline is infrastructure. The useful question is not "how clever is it?" but "can I fix it at the end of a long day?" Four understandable steps beat a sophisticated workflow I am afraid to edit.