Test as far as you can even if you are limited

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2024-04-19

We had a long Makefileused as a grab-box for commands)

log:
    docker-compose logs -f ${container}

build_production:
    docker-compose rm -vsf
    docker-compose down -v --remove-orphans
    docker-compose -f docker-compose.yml -f docker-compose-production.yml build
    docker-compose -f docker-compose.yml -f docker-compose-production.yml up -d

I was asked to append a deploy command, which really just did bin/deploy. Seeing the obvious patten, I added the following entry:

deploy:
  bin/deploy

Because I knew that running this command make deploy would not work on my machine due to credential issues, I committed my changes and pushed without testing.

My client then ran the make build_production (a different command) and it was suddenly broken. Somehow my adding a seemingly unrelated command broke all of them! Here was the error:

Makefile:39: *** missing separator.  Stop.

The issue? Makefiles require tabs not spaces....

As a new Makefile user, I couldn't have easily known this old-fashioned constraint beforehand, so this mistake was forgiveable.

What wasn't forgiveable was that I should have tested the changes in some way before pushing the code. Even though, yes, I could not have deployed, I should have unit-tested the change to the Makefile by at least seeing if the deploy script got called. That would have made me realize the entire Makefile was broken.