-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 build date #14957
Add build date #14957
Conversation
This reverts commit b835699.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build changes here look good - if you were feeling extra you could validate the build date string when it is set, but it's an unlikely failure, happy to save it for if it ever crops up outside my pessimistic take 😂
@modrake, you and I share the same pessimistic take on this 😂. My hope is to write a release smoke test to verify that the build date is set and properly formatted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* add BuildDate to version base * populate BuildDate with ldflags * include BuildDate in FullVersionNumber * add BuildDate to seal-status and associated status cmd * extend core/versions entries to include BuildDate * include BuildDate in version-history API and CLI * fix version history tests * fix sys status tests * fix TestStatusFormat * remove extraneous LD_FLAGS from build.sh * add BuildDate to build.bat * fix TestSysUnseal_Reset * attempt to add build-date to release builds * add branch to github build workflow * add get-build-date to build-* job needs * fix release build command vars * add missing quote in release build command * Revert "add branch to github build workflow" This reverts commit b835699. * add changelog entry
* add BuildDate to version base * populate BuildDate with ldflags * include BuildDate in FullVersionNumber * add BuildDate to seal-status and associated status cmd * extend core/versions entries to include BuildDate * include BuildDate in version-history API and CLI * fix version history tests * fix sys status tests * fix TestStatusFormat * remove extraneous LD_FLAGS from build.sh * add BuildDate to build.bat * fix TestSysUnseal_Reset * attempt to add build-date to release builds * add branch to github build workflow * add get-build-date to build-* job needs * fix release build command vars * add missing quote in release build command * Revert "add branch to github build workflow" This reverts commit b835699. * add changelog entry
* add BuildDate to version base * populate BuildDate with ldflags * include BuildDate in FullVersionNumber * add BuildDate to seal-status and associated status cmd * extend core/versions entries to include BuildDate * include BuildDate in version-history API and CLI * fix version history tests * fix sys status tests * fix TestStatusFormat * remove extraneous LD_FLAGS from build.sh * add BuildDate to build.bat * fix TestSysUnseal_Reset * attempt to add build-date to release builds * add branch to github build workflow * add get-build-date to build-* job needs * fix release build command vars * add missing quote in release build command * Revert "add branch to github build workflow" This reverts commit b835699. * add changelog entry
Core Vault Changes
The concept of a
BuildDate
has been added to theversion
package. This will ultimately be used for Vault Enterprise licensing but has also been added to existing endpoints and commands as follows:sys/seal-status
now includes abuild_date
fieldsys/version-history
now includes abuild_date
field per version entryvault version
will denote the build date of the CLI binary, for exampleVault v1.11.0-dev1 ('e07f614b1493c70a76591abcbb84424682ad8adf+CHANGES'), built 2022-04-07T13:35:26Z
vault status
(which usessys/seal-status
) will include Build Date when using--format=table
and abuild_date
field when using--format=json
vault version-history
(which usessys/version-history
) will include a Build Date when using--format=table
. Using--format=json
will output the rawsys/version-history
response accounting for that endpoint's modified response outlined above.The
sys/version-history
endpoint is backed by thecore/versions
storage entries. These entries are stored as JSON so accounting for the build date simply required providing an extra key. Upon startup, these entries are cached. The cache used to be amap[string]time.Time
but has been modified in a future-proof way to allow for information other than the installation time.Build Tooling Changes
scripts/build_date.sh
was added to fetch the RFC3339-formatted timestamp of the last commit to provide a stable build date across platformsscripts/build.sh
has been modified to provide a build flag via-ldflags
forgithub.com/hashicorp/vault/sdk/version.BuildDate
using thebuild_date.sh
script noted abovescripts/windows/build.bat
has also been modified to set the build date via-ldflags
but does so without a separate scriptbuild
Make target has been modified to accept aVAULT_BUILD_DATE
get-build-date
job has been added to the GitHub build workflows which will callscripts/build_date.sh
and provide the generated string as an outputbuild-*
jobs in the GitHub build workflows use thebuild-date
output from above to specifyVAULT_BUILD_DATE
formake build
branches
list in.github/workflows/build.yml
, subsequently created custom release binary to verify thatBuildDate
is set properlyscripts/windows/build.bat
changes on Windows VMExample output: