fix: replace git hash with build number in UI footer#5153
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5153 +/- ##
============================================
+ Coverage 48.55% 48.57% +0.02%
- Complexity 2372 2375 +3
============================================
Files 1042 1043 +1
Lines 39971 39971
Branches 4252 4251 -1
============================================
+ Hits 19408 19416 +8
+ Misses 19414 19409 -5
+ Partials 1149 1146 -3
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/request-review @bobbai00 |
|
For UI related PRs, please include UI screenshot as the change. Thanks |
| const { version } = require("./package.json"); | ||
| const { resolve, relative } = require("path"); | ||
| const { writeFileSync, existsSync, mkdirSync } = require("fs-extra"); | ||
|
|
||
| const gitInfo = gitDescribeSync({ | ||
| dirtyMark: false, | ||
| dirtySemver: false, | ||
| }); | ||
|
|
||
| gitInfo.version = version; | ||
| const buildNumber = generate(version); |
There was a problem hiding this comment.
can we simply call this method in source code, instead of doing so in post install script? I think we can get rid of such a post install script.
There was a problem hiding this comment.
@Yicong-Huang, this was a design decision because the buildNumber includes the date.
- In the current format, it shows the date when
yarn installis run. - In the advised format (in source code), it shows the date the user loads the page.
If we go with option 2, should I remove the date and show only the version, not the build number?
There was a problem hiding this comment.
hmm. neither option is reflecting the actual build time.
yarn installis to install packages. we need to generate this date when we actually build frontend for prod.- "when user loads the page" is also meaning less to be shown as a build time.
can we bundle this command with yarn run build --prod etc (I might be wrong on the exact build command)?
There was a problem hiding this comment.
for dev environment, it is fine to either show a "dev" or git sha. This feature (show build number) is mainly for production usage.
Signed-off-by: Matthew B. <mgball@uci.edu>
What changes were proposed in this PR?
frontend/git-version.jswithfrontend/build-version.js, which usesbuild-number-generatorto stamp a version + timestamp build number instead of shelling out togit describe.git-describedevDependency forbuild-number-generator, and pointed thepostinstallscript at the new file.src/environments/version.tsschema to{ buildNumber, version }, since the oldgit-describeoutput fields had a single consumer.DashboardComponent.gitCommitHashtobuildNumber, updated the footer label toBuild:, and renamed the#git-commit-idCSS id to#build-number.Any related issues, documentation, or discussions?
closes: #3613
How was this PR tested?
node build-version.jsdirectly and confirmed it wrote a validversion.tswith the newbuildNumberfield.Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.7 in compliance with ASF