Getting CI/CD pipelines out of the copy-paste YAML maze
Every workflow file had the same seven steps pasted into it. Reusable workflows turned seven copies into one.
The pipeline started as one workflow file. Then a second service needed the same build-test-deploy steps, so it got copied. Then a third. By the time there were seven, changing the Node version meant editing seven files and hoping none of them drifted.
The fix was pulling the shared steps into a reusable workflow — checkout, install, test, build, push the image, deploy — parameterized by service name and environment. Each service's workflow file shrank down to a single call with its own inputs.
The other change was separating 'build once' from 'deploy many times'. The image gets built and tagged with the commit SHA exactly once; staging and production both deploy that same artifact instead of rebuilding it, which closes off an entire category of 'it worked in staging' surprises caused by a dependency updating between the two builds.
None of this required a new platform or a rewrite — just refusing to let the seventh copy-paste happen and extracting the pattern instead.
Comments
No comments yet — be the first to say something.