Skip to content
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

Add go build version to version info #62

Merged
merged 2 commits into from
Feb 5, 2021
Merged

Conversation

tomhjp
Copy link
Contributor

@tomhjp tomhjp commented Feb 4, 2021

Following up on a comment from #61.

./_output/secrets-store-csi-driver-provider-vault_darwin_amd64_0.0.7 --version
{"version":"0.0.7","buildDate":"2021-02-04-15:38","goVersion":"go version go1.15.7 darwin/amd64","minDriverVersion":"v0.0.17"}

Copy link

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

LDFLAGS?="-X github.com/hashicorp/secrets-store-csi-driver-provider-vault/internal/version.BuildVersion=$(IMAGE_VERSION) -X github.com/hashicorp/secrets-store-csi-driver-provider-vault/internal/version.BuildDate=$(BUILD_DATE) -extldflags "-static""
LDFLAGS?="-X 'github.com/hashicorp/secrets-store-csi-driver-provider-vault/internal/version.BuildVersion=$(IMAGE_VERSION)' \
-X 'github.com/hashicorp/secrets-store-csi-driver-provider-vault/internal/version.BuildDate=$(BUILD_DATE)' \
-X 'github.com/hashicorp/secrets-store-csi-driver-provider-vault/internal/version.GoVersion=$(shell go version)' \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work on windows (the shell command)? Would it be better to set this version as a variable like we do for BUILD_DATE? Granted I see now that we do shell for IMAGE_VERSION as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out, I hadn't really considered that. I don't have a Windows machine to test on, but I think it may work? As shell is just a Makefile function that says "use the default shell" and I believe it will use cmd.exe and I think go version will work? There are a lot of guesses there, but as mentioned it doesn't change compatibility and Windows support is a fair way off for now, so I'll leave this one as-is for this PR.

Makefile shell docs for reference
Choosing the shell docs which make it sound way more complicated than I said above 😱

Copy link
Contributor

@jasonodonnell jasonodonnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tomhjp tomhjp merged commit dc1ccc4 into master Feb 5, 2021
@tomhjp tomhjp deleted the add-go-build-version branch February 5, 2021 16:00
@tomhjp tomhjp mentioned this pull request Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants