create_build_info_json
This script will create a JSON file at the given path containing build and source control information.
The given path can either be relative to the base directory (-d
) or an absolute path—intermediate directories will not be created.
The following parameters are optional:
d
-
the base directory (
$PWD
if not given) f
-
overwrite the existing file
The value of
|
The value of The following will give you the timestamp of the HEAD commit:
|
This script will add source control information if the base directory (
The value of |
Usage
$ scripts/web/create_build_info_json.sh build-info.json
$ scripts/web/create_build_info_json.sh -f /tmp/build-info.json
$ scripts/web/create_build_info_json.sh -d ~/git_repo src/build-info.json
$ scripts/web/create_build_info_json.sh src/build-info.json
⇓
{"build":{"id":"1710116654","time":"2024-03-11T00:24:14Z"},"git":{"branch":"main","commit":{"id":"b530d501d059e1bbda58d96d78359014effa5584","time":"2024-03-11T00:22:45Z"}}}
$ SOURCE_DATE_EPOCH=0 scripts/web/create_build_info_json.sh src/build-info.json
⇓
{"build":{..."time":"1970-01-01T00:00:00Z"}...}