Solana: Add commit hash to `--version` output of our binaries

Created on 20 Aug 2019  路  3Comments  路  Source: solana-labs/solana

Problem

Since master takes the version string of the next release, it is difficult to tell the difference between a release and edge build from --version alone.

Proposed Solution

https://stackoverflow.com/a/44407625

good first issue

All 3 comments

In the CI environment, we can pull the existing CI_COMMIT env var to get the commit hash.

For dev builds, I think the commit hash should be -unknown or even -$USER. The proposed solution of running git from builds.rs is 馃憥, for one it breaks if you download a release source archive and try to build it

SG. The link was more of a "someone did it like this" than an actual proposal. I've done similar for a project in the past, but it was Autotools and C++, so :cake: What I did there for dev builds was HEAD_commit_hash and an optional ~dirty suffix if the working tree had modifications. $USER can get a little weird if we don't have control over that namespace, but probably not an issue for us at this time.

Fixed a while ago! eg:

solana --version
solana-cli 0.22.4 [channel=beta commit=13af04998874b0ba411e2966b8eb7101192b2783]
Was this page helpful?
0 / 5 - 0 ratings