-
Notifications
You must be signed in to change notification settings - Fork 79
build(cli): filter git tags by cmd/cli prefix for version #507
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ all: build | |
|
|
||
| build: | ||
| @echo "Building $(BINARY_NAME)..." | ||
| go build -ldflags="-s -w -X github.com/docker/model-runner/cmd/cli/desktop.Version=$(shell git describe --tags --always --dirty)" -o $(BINARY_NAME) . | ||
| go build -ldflags="-s -w -X github.com/docker/model-runner/cmd/cli/desktop.Version=$(shell git describe --tags --always --dirty --match "cmd/cli*" | sed 's|^cmd/cli/||')" -o $(BINARY_NAME) . | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current To make the build more robust, you could add a fallback. The suggested change first attempts to find a |
||
|
|
||
| link: | ||
| @if [ ! -f $(BINARY_NAME) ]; then \ | ||
|
|
||
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.
issue (bug_risk): The inner double quotes around --match "cmd/cli*" will likely break the Makefile/ldflags quoting.
Because
-ldflagsis wrapped in double quotes, reusing double quotes inside--match "cmd/cli*"will end the string early in the Makefile, causing parse/build issues or wrong arguments togo build. Please either switch the inner pattern to single quotes or escape the inner quotes (e.g."cmd/cli*") so the fullgit describecommand is passed correctly.