-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1636: Hotfix: Log but don't panic when vergen can't retrieve commit information r=curquiza a=Kerollmops This pull request fixes an issue we discovered when we tried to publish meilisearch v0.21 on brew, brew uses the tarball downloaded from github directly which doesn't contain the `.git` folder. We use the `.git` folder with [vergen](https://docs.rs/vergen) to retrieve the commit and datetime information. Unfortunately, we were unwrapping the vergen result and it was crashing when the git folder was missing. We no more panic when vergen can't find the `.git` folder and just log out a potential error returned by [the git2 library](https://docs.rs/git2). We then just check that the env variables are available at compile-time and replace it with "unknown" if not. ### When the `.git` folder is available ``` xh localhost:7700/version HTTP/1.1 200 OK Content-Type: application/json Date: Thu, 26 Aug 2021 13:44:23 GMT Transfer-Encoding: chunked { "commitSha": "81a76eab69944de8a8d5006345b5aec7b02acf50", "commitDate": "2021-08-26T13:41:30+00:00", "pkgVersion": "0.21.0" } ``` ### When the `.git` folder is unavailable ```bash cp -R meilisearch meilisearch-cpy cd meilisearch-cpy rm -rf .git cargo clean cargo run --release <snip> Compiling meilisearch-http v0.21.0 (/Users/clementrenault/Documents/meilisearch-cpy/meilisearch-http) warning: vergen: could not find repository from '/Users/clementrenault/Documents/meilisearch-cpy/meilisearch-http'; class=Repository (6); code=NotFound (-3) ``` ``` xh localhost:7700/version HTTP/1.1 200 OK Content-Type: application/json Date: Thu, 26 Aug 2021 13:46:33 GMT Transfer-Encoding: chunked { "commitSha": "unknown", "commitDate": "unknown", "pkgVersion": "0.21.0" } ``` Co-authored-by: Kerollmops <clement@meilisearch.com>
- Loading branch information
Showing
6 changed files
with
14 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters