Skip to content
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

Add the new commit count and git hash to the version #2038

Merged
merged 6 commits into from
Apr 21, 2021

Conversation

teor2345
Copy link
Contributor

Motivation

When someone is running on a git branch, sometimes it's hard to tell which version they branched off.

Solution

Add the following info to the version in the panic, ticket template, and sentry report metadata:

  • the number of commits since the last git tag
  • the git commit hash (a bit repetitive, but it matches the "git semver" format)

The code in this pull request has:

  • Documentation Comments
  • Acceptance Tests

Manual Test Output

Cause a port/database conflict panic:

zebrad start 2> /dev/null &
zebrad start
killall zebrad
Metadata:
version: 1.0.0-alpha.1+332.g3a992dd
branch: vergen-git-tag-count-hash
git commit: 3a992dd
commit timestamp: 2021-04-20T07:09:02+00:00
target triple: x86_64-unknown-linux-gnu
Zcash network: Mainnet

Review

This useful debugging feature can be reviewed by anyone at any time.

Related Issues

Adds commits to PR #2037

Follow Up Work

Use the target triple even if there is no .git directory, needs rustyhorde/vergen#64

@teor2345 teor2345 added A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement P-Low I-usability Zebra is hard to understand or use labels Apr 20, 2021
@teor2345 teor2345 requested a review from a team April 20, 2021 07:47
@teor2345 teor2345 self-assigned this Apr 20, 2021
@teor2345 teor2345 changed the title Add the new commit count and git hash to the version Add the new commit count and git hash to the version (needs rebase after #2037) Apr 20, 2021
@teor2345 teor2345 force-pushed the vergen-git-tag-count-hash branch from 79bd2fb to c4b1860 Compare April 21, 2021 00:24
@teor2345 teor2345 changed the title Add the new commit count and git hash to the version (needs rebase after #2037) Add the new commit count and git hash to the version Apr 21, 2021
@teor2345 teor2345 marked this pull request as ready for review April 21, 2021 00:26
Comment on lines +25 to +29
impl From<Network> for &'static str {
fn from(network: Network) -> &'static str {
(&network).into()
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +53 to +54
// strip the leading "v", if present
if &vergen_git_semver[0..1] == "v" {
Copy link
Contributor

Choose a reason for hiding this comment

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

lol, this is such a funny convention variance, depending on where published

Comment on lines +223 to +224
("branch", option_env!("VERGEN_GIT_BRANCH").map(Into::into)),
("git commit", Self::git_commit().map(Into::into)),
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -233,7 +289,7 @@ impl Application for ZebradApp {
let guard = sentry::init(
sentry::ClientOptions {
debug: true,
release: Self::git_commit().map(Into::into),
release: Some(app_version().to_string().into()),
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@dconnolly dconnolly added this to the 2021 Sprint 8 milestone Apr 21, 2021
@dconnolly dconnolly enabled auto-merge (rebase) April 21, 2021 21:45
@teor2345 teor2345 disabled auto-merge April 21, 2021 21:56
@teor2345 teor2345 enabled auto-merge (squash) April 21, 2021 21:56
@teor2345
Copy link
Contributor Author

I want to squash this one to get rid of the tiny commits and buggy commits.

@teor2345 teor2345 merged commit 96b3c94 into ZcashFoundation:main Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement I-usability Zebra is hard to understand or use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants