-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
lodestar/cli: overhaul util/version and gitdata #2958
Conversation
Code Climate has analyzed commit 9a54076 and detected 0 issues on this pull request. View more on Code Climate. |
This pull request introduces 3 alerts when merging d43112e into 80c248b - view on LGTM.com new alerts:
|
I would appreciate if we can make a test point release (v0.28.2) if this is good to go. |
Performance Report✔️ no performance regression detected Full benchmark results
|
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.
LGTM!
I tested locally against this branch and with a mock v0.28.2 release.
This shouldn't effect our npm releases, it will just make lodestar --version
more accurate.
Ok, fixed the linter issues, this should be good to go. |
Sorry, fixed one minor logic issue. Now it's good to go. |
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.
Looks great! Much more accurate and polished than before.
The purpose of the gitData file was to distribute the commit at which that version is built to NPM. Since (package.json).version
only includes the semver, that information is not available and you need to go to git to check the commit associated to that tag. That has been very useful for nightly releases since we show the "version" tag (version + branch + commit) in the metrics panel, so very quickly you can check what that node is running from Grafana.
Do you think we achieve a similar behavior is more clean and polished way?
Thanks for the review. The logic around gitData was not changed and should be still available. Do you mean, we should expose branch and commit on the metrics even though it's usually a tag release? Metrics is the only place where I changed it for simplicity but happy to add back more details. |
@q9f Another better option would be to use nightly versioning as |
I just checked, the nighly release version is
At first glance, there seems no easy way to force lerna to do that properly. |
What if we write our own version format? Not use any counter at all and only the commit hash:
|
Motivation
Allow for more information in the version string; also clean up util/version and gitdata and reduce duplicated code.
Description
util/gitData/*
no longer generates version strings, it just handles all version information (semver, branch, commit, ...)util/version
now generates a proper version string from available data (either from json or from git)v0.28.1/q9-yarn-semver/+14/b0616bfd (unstable)
(semver/branch/number of commits since last release/commit hash/release track if any)util/version
now defines a default release track (stability), for now:alpha
cli/cli
improved top banner of the--help
output and also used same information for--version
The code also handles the logic of releases and dirty/nightly builds. A release version string is simply
v0.28.1 (alpha)
whereas dirty builds have all infov0.28.1/q9-yarn-semver/+14/b0616bfd (unstable)
. If git data is not available, it will fall back to lerna.json/package.json and just use0.28.1
.This is my first typescript contribution. Review with care. 🙏🏼
Fixes #2950