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

Build date and commit ID missing from binary #87

Open
gruyaume opened this issue Mar 21, 2024 · 2 comments
Open

Build date and commit ID missing from binary #87

gruyaume opened this issue Mar 21, 2024 · 2 comments

Comments

@gruyaume
Copy link
Contributor

gruyaume commented Mar 21, 2024

Describe the bug

The build date is missing from the vault binary. When you run vault status, you see n/a as the build date.

To Reproduce

  1. Install the vault snap: sudo snap install vault
  2. Start the vault daemon: sudo snap start vault.vaultd
  3. Run vault status
guillaume@potiron:~$ vault status
Key                Value
---                -----
Seal Type          shamir
Initialized        false
Sealed             true
Total Shares       0
Threshold          0
Unseal Progress    0/0
Unseal Nonce       n/a
Version            1.15.6
Build Date         n/a
Storage Type       file
HA Enabled         false

Here note the n/a next to Build Date.

The same can be observed when running vault --version, where we only see the vault version.

guillaume@potiron:~$ vault --version
Vault v1.15.6 (cgo)

Expected behavior

The following outputs are taken from running the same commands using the vault debs:

guillaume@potiron:~$ vault status
Key                Value
---                -----
Seal Type          shamir
Initialized        false
Sealed             true
Total Shares       0
Threshold          0
Unseal Progress    0/0
Unseal Nonce       n/a
Version            1.15.6
Build Date         2024-02-28T17:07:34Z
Storage Type       file
HA Enabled         false

And in the vault version command:

guillaume@potiron:~$ vault --version
Vault v1.15.6 (615cf6f1dce9aa91bc2035ce33b9f689952218f0), built 2024-02-28T17:07:34Z

Environment

  • Snap revision: 2213
  • Snap channel: 1.15/stable
  • Vault version: 1.15.6
  • Ubuntu version: 22.04
@gruyaume gruyaume added the bug label Mar 21, 2024
@gruyaume
Copy link
Contributor Author

gruyaume commented Mar 21, 2024

I'm pretty sure this can be fixed by using the following ldflags at build time:

-ldflags "${LD_FLAGS} -X github.com/hashicorp/vault/version.GitCommit='${GIT_COMMIT}${GIT_DIRTY}' -X github.com/hashicorp/vault/version.BuildDate=${BUILD_DATE}" \

Reference:

@gruyaume gruyaume changed the title Build date missing from binary Build date and commit ID missing from binary Mar 21, 2024
@gruyaume
Copy link
Contributor Author

Plus, whatever we do here, let's make sure we port it to the rock:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant