99 versions are not good enough – [Everyday Code]
This article is part of the series [Everyday Code]
You’ve done nothing until you release more than 99 versions of your product. 99 versions are just not good enough.
TL;DR;
Today we released version 103 of is-core – the core of the Instruction Steps Framework. We noticed a bug. Generally the build would produce two files:
is-core-sdk-6.0.0.pre.103.js - that is the current version
is-core-sdk-latest.js - this is pointing to the content of the latest version.
Problem was that while the current version was 103, the latest version in is-core-sdk-latest.js was pointing to version is-core-sdk-6.0.0.pre.99.js.
As a conclusion – You have done nothing until you’ve released at least 100 versions of your software (and probably at least it works through a millennium shift with a leap year, but that’s another story)
Details
It’s pretty simple actually. This is what we were doing to get the latest file generated:
# Creates is-core-sdk-latest.js link to the latest compiled
cd ../../release
rm is-core-sdk-latest.js -f
-latest=`find is-core-sdk-* -type f | tail -1`
+latest=`ls -1v is-core-sdk* | tail -1`
echo "Latest sdk is: $latest"
Notice the find is-core-sdk-* -type f | tail -1
If the files are like
# Find all the files but they are listed in non natural order of the integer for the version.
# This code is: BAD
$ find is-core-sdk-* -type f
is-core-sdk-6.0.0.pre.102.js
is-core-sdk-6.0.0.pre.103.js
is-core-sdk-6.0.0.pre.97.js
is-core-sdk-6.0.0.pre.98.js
# If we get just the tail it will give us version 99 which is clearly not right
$ find is-core-sdk-* -type f | tail -1
is-core-sdk-6.0.0.pre.99.js
I have done this mistake at least a few times in my career.
Solution is an option in ls:
# This code is GOOD
# This will list all the files
$ ls -1v is-core-sdk*
is-core-sdk-6.0.0.pre.97.js
is-core-sdk-6.0.0.pre.98.js
is-core-sdk-6.0.0.pre.102.js
is-core-sdk-6.0.0.pre.103.js
# This will get just the last
$ ls -1v is-core-sdk* | tail -1
is-core-sdk-6.0.0.pre.103.js
Moral of the story
For months I thougth we have a rock solid infrastructure. There was almost no failed build. Delivery to production is in 2 minutes for a pretty complex framework with a lot of projects and modules. And then it “broke” after months of stable work just as we were to release version 100.
Show me your 100-th version of your product. Then we can talk.
Reply
You must be logged in to post a comment.