Better build plans for better builds

Mike Kowdley
1 min readDec 28, 2020

--

I’m a big fan of relying on automation to help catch our mistakes. With a developer and a QA dev separated by nine time zones, we recently lost a full day on shipping something that could have easily been caught with automation.

In our particular case, we have a directory containing a few dozen XML files that define database schema changes using Liquibase, and a master changelog.xml file that lists each file that should be applied, in order. Each time we add a schema change file, that same file should be added to the changelog.xml.

What happens if you don’t add it? The schema change file is part of the pull request, but it doesn’t actually get applied when Liquibase runs. This is always a configuration error.

This problem has a trivial solution — verify each XML file is listed in the changelog.xml file.

#!/bin/bashcd schema/src/main/resources/liquibase FILES=`find data -name “*.xml”`
for fn in $FILES
do
if ! grep -q $fn ./changelog.xml; then
echo “FAIL Liquibase configuration problem: schema change file $fn is not listed in changelog.xml”
exit 1
fi
done
echo “$0: PASS”

Simple, fast, and importantly, the message that shows up in the build log will be clear to any reader about the problem. Hope this helps!

--

--

No responses yet