Something curious happened when I was working on a project that uses Gitlab CI/CD. My project was broken up into a build, deploy, and test stage for a web server hosted on an AWS EC2 instance. Every time it got to the test stage (which ran a CURL command on the web server's IP address to see if the site was up), the CI/CD pipeline would fail. I couldn't make out why this was the case.
Then I took a deeper look at the pipeline and made out why. The deploy and test stage bled into one another. I made it so that the deploy stage simply ran a job to create the resources on AWS needed for the web server. It didn't wait for the creation to finish. That was another part of the test stage. The test stage would wait until the web server was created before it ran the CURL command. But I suspect there might have been some time between the resources being created and the web server being accessible —something i didn't take into account at all.
The problem was that the deploy and test stages blended into each other. It made me think of how being musical is blending measures together to form a beautiful piece of music. You don't want to be rigid. There has to be flow from one passage to the next. But the problem here is that what's musicality in playing classical guitar is disaster in CI/CD pipelines. It made the process all the more messier. Why would you wait for the deploy to be done when you were on the test stage? Rigidity had to save the day, so I added to the deploy stage that it had to wait for the resources to be done in order to move onto the next stage. Then, when onto the test stage, it would only run the CURL command and nothing else — not wait for the resources to be made.
Of course I'm probably off as to why the CURL command didn't work. I can always edit my pipeline code to make it even better. Regardless, this was a curious case to me of how mixing metaphors with programming (oh it's just like music) can collide when applying to the real world, that sometimes the thing that you shy away from in one field is what will help you in another.