-
Notifications
You must be signed in to change notification settings - Fork 2.6k
allow for VERSION and REVISION to be passed in during docker builds #2955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Alex Laties <agl@tumblr.com>
Codecov Report
@@ Coverage Diff @@
## master #2955 +/- ##
==========================================
- Coverage 60.59% 60.54% -0.05%
==========================================
Files 102 102
Lines 8025 8025
==========================================
- Hits 4863 4859 -4
- Misses 2512 2515 +3
- Partials 650 651 +1
Continue to review full report at Codecov.
|
weird... i don't understand how I'm reducing code coverage in |
@manishtomar @caervs is it possible to get eyes on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (not a maintainer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would love to see a bash doc about ?=
.
VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always) | ||
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) | ||
VERSION ?= $(shell git describe --match 'v[0-9]*' --dirty='.m' --always) | ||
REVISION ?= $(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my own understanding could you please link to bash doc or any page that describes that ?=
means use variable value if provided otherwise calculate from command. I only see ${VAR:-20}
when searching online. I may very well be dumb in looking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case it's a makefile syntax; https://www.gnu.org/software/make/manual/html_node/Setting.html#Setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. TL;DR ?=
assigns the expression to the variable if and only if the variable is undefined in the environment. If defined and empty, ?=
will not assign the expression. The expression is lazily evaluated recursively on use, similar to =
.
It's a surprisingly lesser known feature but extremely useful. Handles cases where you wish for VERSION
or REVISION
to be intentionally blanked out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂ Its a makefile change. Thanks for the doc!
solve for #2953
Allows
VERSION
andREVISION
to be set via build args.E.G
docker build --build-arg VERSION=somerelease --build-arg REVISION=internalRev .