-
Notifications
You must be signed in to change notification settings - Fork 920
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: use embedded files instead of ldflags to get the build info during runtime #2421
Conversation
… during runtime Signed-off-by: Jose Ramon Mañes <jose@celestia.org>
Signed-off-by: Jose Ramon Mañes <jose@celestia.org>
Signed-off-by: Jose Ramon Mañes <jose@celestia.org>
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 don't believe version.go
is used in any unit tests, so can you add //+build: !test
at top of file pls? Otherwise it'll throw errors
Are we 100% this is the only way to fix this? I've seen various projects using ldflags and docker together without needing to do this setup. |
Signed-off-by: Jose Ramon Mañes <jose@celestia.org>
I think so, at least the other changes haven't worked, the other thing we can try is to move the |
buildTime string | ||
lastCommit string | ||
buildTime string | ||
//go:embed lastCommit.txt |
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.
we need to document this lastCommit.txt here.
And exclude it from the the go test executor
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.
see my commetn
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.
Hmm the no build directive for tests seems to not work @jrmanes do you mind looking into it?
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 can take a look 👌
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.
to fix the tests, we can either add the files lastCommit.txt
& semanticVersion.txt
to the repo (they can be empty), or run the make gen-embed
before make test
, but if we run go test ./...
it will fail if these files are not there
wdyt?
Signed-off-by: Jose Ramon Mañes <jose@celestia.org>
hello team! I've created a new version in the common pipeline, this one should fix the issues with the forks and we'll have the version output that we're currently missing when using the docker containers. If this works, we could close the PR: #2421 I've tested on my end and seems to be working crossed_fingers PR where we've done the fix: celestiaorg/.github#65 Thanks in advance! rocket Jose Ramon Mañes celestiaorg/devops#370
hello team! we can close this PR, we fixed the issue using the latest version of the pipeline I've done a couple of tests with different commits, and I can see it working 🔥 cheers! 🚀 |
hello team,
I've added this small fix to use embed files rather than ldflags, we are missing the build info during the runtime (in Docker containers) and I think that's the only way to fix it...
Also, I added a couple of things to the Makefile.
The result of this looks like this:
Please let me know what you think about it.
Best,
Jose Ramon Mañes