A simple script for finding your next version number
Jul 09, 2020
Here's a small script that can suggest a version number for an application running on docker-compose.
At Zero-One we have quite a few applications that run on docker-compose and use Semantic Versioning when we deploy. Our build script takes a version number as an argument, but it was always a hassle to find the latest version number so that we could figure out what the next one should be. We would run this command, and then sift through the output, like an animal:
docker images | grep myfancyapp | sort -V
This command would yield the following output:
From there, we'd decide:
4.0.0 if it's a Major Version release, or...
3.12.0 if it's a Minor Version release, or...
3.11.2 if it's a Patch/Bug-fix Version release.
We now run this simple script, and it gives us a list potential version numbers:
We plan to extend our build script to take major, minor, or patch as arguments instead of actual version numbers, and incorporate this script's logic in to save us a step. In the meantime, here's the script, have fun with it, and forgive my poor shell-fu.