提交 11935267 编写于 作者: C Cai Yudong 提交者: Jin Hai

show last commit id when server start (#717)

* #709 show last commit id when server start

* #709 fix typo error
上级 5bec93bf
......@@ -69,6 +69,7 @@ Please mark all change in change log and use the ticket from JIRA.
- \#560 - Add version in server config file
- \#605 - Print more messages when server start
- \#644 - Add a new rpc command to get milvus build version whether cpu or gpu
- \#709 - Show last commit id when server start
## Improvement
- \#255 - Add ivfsq8 test report detailed version
......
......@@ -23,6 +23,7 @@ message(STATUS "Building using CMake version: ${CMAKE_VERSION}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# get build time
MACRO(GET_CURRENT_TIME CURRENT_TIME)
execute_process(COMMAND "date" +"%Y-%m-%d %H:%M.%S" OUTPUT_VARIABLE ${CURRENT_TIME})
ENDMACRO(GET_CURRENT_TIME)
......@@ -35,6 +36,7 @@ if (NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build.")
endif ()
# get Milvus version via branch name
set(GIT_BRANCH_NAME_REGEX "[0-9]+\\.[0-9]+\\.[0-9]")
MACRO(GET_GIT_BRANCH_NAME GIT_BRANCH_NAME)
......@@ -57,6 +59,21 @@ endif ()
set(MILVUS_VERSION "${GIT_BRANCH_NAME}")
string(REGEX MATCH "${GIT_BRANCH_NAME_REGEX}" MILVUS_VERSION "${MILVUS_VERSION}")
# get last commit id
MACRO(GET_LAST_COMMIT_ID LAST_COMMIT_ID)
execute_process(COMMAND sh "-c" "git log --decorate | head -n 1 | awk '{print $2}'"
OUTPUT_VARIABLE ${LAST_COMMIT_ID})
ENDMACRO(GET_LAST_COMMIT_ID)
GET_LAST_COMMIT_ID(LAST_COMMIT_ID)
message(STATUS "LAST_COMMIT_ID = ${LAST_COMMIT_ID}")
if (NOT LAST_COMMIT_ID STREQUAL "")
string(REGEX REPLACE "\n" "" LAST_COMMIT_ID ${LAST_COMMIT_ID})
endif ()
set(LAST_COMMIT_ID "${LAST_COMMIT_ID}")
# set build type
if (CMAKE_BUILD_TYPE STREQUAL "Release")
set(BUILD_TYPE "Release")
else ()
......
......@@ -63,6 +63,7 @@ print_banner() {
#else
std::cout << "You are using Milvus CPU edition" << std::endl;
#endif
std::cout << "Last commit id: " << LAST_COMMIT_ID << std::endl;
std::cout << std::endl;
}
......
......@@ -17,4 +17,5 @@
#cmakedefine MILVUS_VERSION "@MILVUS_VERSION@"
#cmakedefine BUILD_TYPE "@BUILD_TYPE@"
#cmakedefine BUILD_TIME @BUILD_TIME@
\ No newline at end of file
#cmakedefine BUILD_TIME @BUILD_TIME@
#cmakedefine LAST_COMMIT_ID "@LAST_COMMIT_ID@"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册