mirror of https://github.com/thesofproject/sof.git
version.cmake: don't trust CI to record time and versions and log ourselves
In an ideal world, every CI engine records and shares the most important CI information: - current date and time in a well identified timezone - git version of the pull request - git version of the moving branch the PR is being merged with In the real world we have multiple CI solutions and they unfortunately cannot not all be trusted to perform their most basic job correctly. Fortunately, they all make at least build logs available so these very few lines of code adding very few lines of output cost near zero extra build time and solve the problem once for all. I feel stupid I didn't do this sooner, this would have saved me hours and hours in vain requests and discussions and in trying to puzzle that information together. Sample output: -- Preparing Xtensa toolchain version.cmake starting SOF build at 2021-03-31T18:09:46Z UTC Building git commit with parent(s): 150fd1e4c968 4249bdb1b305 [other parent if merge] (HEAD -> main) cmake: ... -- GIT_TAG / GIT_LOG_HASH : v1.7-rc1-174-g150fd1e4c968-dirty / 150fd1e4c968 Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
parent
b5219d844c
commit
a5899812b7
|
@ -11,6 +11,29 @@ cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
set(VERSION_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/version.cmake)
|
set(VERSION_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/version.cmake)
|
||||||
|
|
||||||
|
|
||||||
|
# In an ideal world, every CI engine records the most basic and most
|
||||||
|
# important information:
|
||||||
|
# - current date and time
|
||||||
|
# - git version of the pull request
|
||||||
|
# - git version of the moving branch it's being merged with
|
||||||
|
#
|
||||||
|
# In the real world, some CI results use a random timezone without
|
||||||
|
# telling which one or don't provide any time at all.
|
||||||
|
string(TIMESTAMP build_start_time UTC)
|
||||||
|
message(STATUS "version.cmake starting SOF build at ${build_start_time} UTC")
|
||||||
|
|
||||||
|
# Most CI engines test a temporary merge of the pull request with a
|
||||||
|
# moving target: the latest target branch. In that case the SHA version
|
||||||
|
# gathered by git describe is disposable hence useless. Only the
|
||||||
|
# --parents SHA are useful.
|
||||||
|
message(STATUS "Building git commit with parent(s):")
|
||||||
|
# Note execute_process() failures are ignored by default (missing git...)
|
||||||
|
execute_process(
|
||||||
|
COMMAND git log --parents --oneline --decorate -n 1 HEAD
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Don't confuse this manual _input_ file with the other, output file of
|
# Don't confuse this manual _input_ file with the other, output file of
|
||||||
# the same name auto-generated in the top _build_ directory by "make
|
# the same name auto-generated in the top _build_ directory by "make
|
||||||
# dist", see dist.cmake
|
# dist", see dist.cmake
|
||||||
|
|
Loading…
Reference in New Issue