This hopefully should have no impact on developer workflows nor on how a (pre-)released build works. However in cases where a matching controller docker image does not exist, it will fail fast, rather than deploying a (potentially incompatible) controller from a docker image built for some earlier commit.
Implementation:
first, set pkg/version.gitVersion to a version string using $LDFLAGS only when a tagged commit is checked out (this will always be true for release builds). In other cases, set it to a sentinel value.
then refuse to kudo init unless the sentinel value is overridden explicitly.
changed the sentinel value as you suggested. I think it conveys the intent beter.
removed the exact flag name from the error message, and added a mention of "not released", since we probably want to use this as a hint that "maybe you should not be building this yourself" rather than triggering a knee-jerk reaction of using --version. If someone really wants to use it this way, they should be able to find the right flag from the kubectl kudo help init.
redirected errors from the tag discovery command to /dev/null
What this PR does / why we need it:
This hopefully should have no impact on developer workflows nor on how a (pre-)released build works. However in cases where a matching controller docker image does not exist, it will fail fast, rather than deploying a (potentially incompatible) controller from a docker image built for some earlier commit.
Implementation:
pkg/version.gitVersion
to a version string using$LDFLAGS
only when a tagged commit is checked out (this will always be true for release builds). In other cases, set it to a sentinel value.kudo init
unless the sentinel value is overridden explicitly.Fixes #1549
Signed-off-by: Marcin Owsiany mowsiany@D2iQ.com