-
Notifications
You must be signed in to change notification settings - Fork 242
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
fix: overlay IPAM not reporting version #2090
Conversation
@nddq what's the output of |
@@ -1,6 +1,6 @@ | |||
package buildinfo | |||
package buildversion |
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.
why renaming and moving these around?
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.
this file should be deleted entirely
Makefile
Outdated
@@ -173,7 +173,7 @@ zapai-version: ## prints the zapai version | |||
|
|||
# Build the delegated IPAM plugin binary. | |||
azure-ipam-binary: | |||
cd $(AZURE_IPAM_DIR) && CGO_ENABLED=0 go build -v -o $(AZURE_IPAM_BUILD_DIR)/azure-ipam$(EXE_EXT) -ldflags "-X main.version=$(AZURE_IPAM_VERSION)" -gcflags="-dwarflocationlists=true" | |||
cd $(AZURE_IPAM_DIR) && CGO_ENABLED=0 go build -v -o $(AZURE_IPAM_BUILD_DIR)/azure-ipam$(EXE_EXT) -ldflags "-X buildversion.BuildVersion=$(AZURE_IPAM_VERSION)" -gcflags="-dwarflocationlists=true" |
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.
could just change this to buildinfo.Version
without renaming/moving the files
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.
I was trying to match and see if this work but no luck. I did tried populating buildversion.BuildVersion
directly before but no luck either. The only way I managed to get the version printed out is to have the version
variable inside main
then populate it through main.Version
like CNI and CNS does right now. Is this the only way or I'm I missing something?
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.
what you're missing is that main.version
works in our linker args because main
is the top level package and we have the version
var defined there. to inject a value more deeply, we need to fully-qualify the path.
read the comments in the file you linked and check the mentioned "linker script", you'll see how we need to pass the full path to the buildversion
package and variable for the injection to work. we should not need to change anything except the "-X [...]=$(AZURE_IPAM_VERSION)"
. our Makefile will automatically set that AZURE_IPAM_VERSION
env var at runtime to either the bare tag if the current revision is tagged, or the latest tag + dirty hash if the current rev is not tagged.
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.
yup, working now
|
* fix overlay IPAM not reporting version * revert file and var naming, add correct path to makefile
* fix overlay IPAM not reporting version * revert file and var naming, add correct path to makefile
Reason for Change:
Issue Fixed:
Fixes #2081
Requirements:
Notes: