Skip to content

Conversation

@bhandras
Copy link
Member

@bhandras bhandras commented Apr 4, 2025

With this commit we extend GetinfoResponse with the strict commit hash (which also includes whether the build tree was clean or dirty).

@bhandras bhandras requested review from hieblmi and sputn1ck April 4, 2025 07:00
@bhandras
Copy link
Member Author

bhandras commented Apr 4, 2025

cc: @itsrachelfish, @ellemouton

Makefile Outdated
GOMOD := GO111MODULE=on go mod

COMMIT := $(shell git describe --abbrev=40 --dirty)
COMMIT := $(shell git describe --abbrev=40 --dirty --tags --long)
Copy link
Member

Choose a reason for hiding this comment

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

another option could be to add a separate COMMIT_HASH and then set that separately to the COMMIT one.

but that of course would result in needing a new global variable & then a new commit_hash rpc field in GetInfo.

So I guess we just need to decide if we want to keep the COMMIT working as it does today where if the "pure" tagged version is being run, then no commit hash is included in this variable.

But if it doesnt matter, then this is probs the easiest solution.

wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great idea, PTAL.

@bhandras bhandras force-pushed the ldflags-extended-commit branch 2 times, most recently from 989f163 to 055712b Compare April 4, 2025 10:36
@bhandras bhandras changed the title build: always include the commit in the version, even if tagged build+loop: add the commit hash to GetInfoResponse and change version semantics Apr 4, 2025
@bhandras bhandras force-pushed the ldflags-extended-commit branch from 055712b to a0dd983 Compare April 4, 2025 10:38
@bhandras bhandras requested a review from ellemouton April 4, 2025 10:39
Copy link
Member

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the change!

@bhandras bhandras force-pushed the ldflags-extended-commit branch 2 times, most recently from 6d3b3c4 to cbb74f4 Compare April 4, 2025 10:46
bhandras added 2 commits April 4, 2025 12:47
With this commit we extend GetinfoResponse with the strict commit hash
(which also includes whether the build tree was clean or dirty).
@bhandras bhandras force-pushed the ldflags-extended-commit branch from cbb74f4 to 9a6266f Compare April 4, 2025 10:47
Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

nice - lgtm!!

GOMOD := GO111MODULE=on go mod

COMMIT := $(shell git describe --abbrev=40 --dirty)
COMMIT := $(shell git describe --abbrev=40 --dirty | sed -E 's/.*-g([0-9a-f]{40})(-dirty)?/\1\2/')
Copy link
Member

Choose a reason for hiding this comment

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

nice!

@bhandras bhandras merged commit bfe7991 into lightninglabs:master Apr 4, 2025
4 checks passed
@bhandras bhandras deleted the ldflags-extended-commit branch April 4, 2025 11:01
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.

3 participants