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

Stop assuming there will always be a git commit #2037

Merged
merged 1 commit into from
Apr 20, 2021

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Apr 20, 2021

Motivation

Since #1741, Zebra assumes that there will always be a .git directory. Even before that, Zebra assumed that there would always be some kind of git commit hash available.

Solution

Enable builds where:

  • there is no google cloud git commit env var, and
  • there is no .git directory.

By making all vergen env vars optional, and skipping any env vars that don't exist.

The code in this pull request has:

  • Documentation Comments
  • Acceptance Tests

Manual Test Output

Cause a port/database conflict panic:

zebrad start > /dev/null &
zebrad start
killall zebrad

Without .git directory (and no google cloud git commit env var):

Metadata:                                                                                                                                                                                      
version: 1.0.0-alpha.6                                                                                                                                                                         Zcash network: Mainnet                                                                                                                                                                                                                                                                                                                                                                          ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━                                                                                                                                                                                                                                                                                                            
   0: zebrad::application:: with net="Main"                                                                                                                                                    
      at zebrad/src/application.rs:292   

Note that the target triple is also skipped, even though we can discover it directly from cargo. See rustyhorde/vergen#64.

With a .git directory:

Metadata:                                
version: 1.0.0-alpha.6
branch: vergen-no-git-fix
git commit: 102e465                                                                                                                                                                            
commit timestamp: 2021-04-20T07:05:45+00:00
target triple: x86_64-unknown-linux-gnu                                                        
Zcash network: Mainnet

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                                                                                                                                                                               
   0: zebrad::application:: with zebrad="102e465" net="Main"                                                                                                                                   
      at zebrad/src/application.rs:290    

Review

This fix is urgent because the CD task is failing.

Related Issues

Caused by PR #2029.

Follow Up Work

Fix the cargo target triple and supply a better git commit version.

Enable builds where:
* there is no google cloud git commit env var, and
* there is no `.git` directory.

By making all `vergen` env vars optional, and skipping any env vars that
don't exist.
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-bug Category: This is a bug I-integration-fail Continuous integration fails, including build and test failures
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants