Skip to content

config: use a different source of versioning#9486

Merged
cmwaters merged 7 commits intomainfrom
cal/cfg-version
Oct 4, 2022
Merged

config: use a different source of versioning#9486
cmwaters merged 7 commits intomainfrom
cal/cfg-version

Conversation

@cmwaters
Copy link
Contributor

Config versioning pulls the version from version.TMCoreSemVer. When building in this repo, the Makefile injects the git branch name as the version, overwriting this value. git branch names of course don't follow semver so the config errors on startup.

This PR changes the config version to use version.TMVersionDefault which we manually set.

I think we should consider removing this Makefile injection.

# If building a release, please checkout the version tag to get the correct version setting
ifneq ($(shell git symbolic-ref -q --short HEAD),)
VERSION := unreleased-$(shell git symbolic-ref -q --short HEAD)-$(shell git rev-parse HEAD)
else
VERSION := $(shell git describe)
endif

LD_FLAGS = -X github.com/tendermint/tendermint/version.TMCoreSemVer=$(VERSION)

The main value seems to be making it easier to tell what branch a node is based off but engineers can just as easily communicate that

@cmwaters cmwaters requested a review from ebuchman as a code owner September 23, 2022 07:56
@cmwaters cmwaters requested a review from a team September 23, 2022 07:56
@jmalicevic
Copy link
Contributor

If the code above in the Makefile does not pass our own validation, we should remove it, I find it confusing. Or we can change what was done here: #9413 to put the default into the config file (with a warning) if the version used is not tagged as a release.

@jmalicevic
Copy link
Contributor

jmalicevic commented Sep 30, 2022

I see a few more places where the version is set based on git describe : tools/tm-signer-harness/Makefile, .goreleaser.yml, scripts/dist.ch.

@sergio-mena
Copy link
Contributor

I don't have the full context on this PR; but I'd like to understand the motivation for the change. My impression is that having the git hash in the version is very useful to find out the code behind a log.
For "official" versions, like releases and release candidates, the hash shouldn't be there, but in any other build, I see it of great help.
So, as said above, I'd like to understand the rationale for removing this logic (probably synchronously would be more effective)

@thanethomson
Copy link
Contributor

Related: #9503.

I'm not convinced though that this PR is the best approach. I agree with @sergio-mena that having the commit hash in the version is useful. The way this is usually handled in semver, however, is to use build metadata.

For example, building off of a tagged commit should produce the version specified in TMCoreSemVer, like v0.38.0-dev.

Building off of a branch or non-tagged commit should produce v0.38.0-dev+ee4023a. The commit hash can simply be obtained from git rev-parse --short HEAD.

@sergio-mena
Copy link
Contributor

Just discussed with @cmwaters synchronously. My understanding is that we agree for the hash to be there (appended at the end) in our "Makefile" when we are "git checked out" on a commit that has no release (or release candidate) tag; and should not be there in any alpha, beta, release candidate, or official release.

@cmwaters
Copy link
Contributor Author

cmwaters commented Oct 4, 2022

ok I've used git rev-parse --short HEAD and appended the commit hash to the end of TMCoreSemVer.

Just as a reminder, this only really affects us, the engineering team, who use the Makefile to build the tendermint binary.

Copy link
Contributor

@thanethomson thanethomson 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 @cmwaters. I see the linter's complaining about the code not being formatted though?

Copy link
Contributor

@sergio-mena sergio-mena left a comment

Choose a reason for hiding this comment

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

Thanks!

@cmwaters cmwaters merged commit a02cc30 into main Oct 4, 2022
@cmwaters cmwaters deleted the cal/cfg-version branch October 4, 2022 13:01
troian pushed a commit to akash-network/tendermint that referenced this pull request Mar 11, 2023
* config: use a different source of versioning (tendermint#9486)

* Changed version generation

* Fixed comment describing the versioning

Co-authored-by: Callum Waters <cmwaters19@gmail.com>
adrianbrink pushed a commit to heliaxdev/tendermint that referenced this pull request May 23, 2023
Co-authored-by: Callum Waters <cmwaters19@gmail.com>
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