Skip to content
Snippets Groups Projects
Commit 1f2cfe17 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

CI: allow configurable builds outside gitlab-runner

parent 9fed002d
No related branches found
No related tags found
No related merge requests found
......@@ -26,13 +26,22 @@ set (ENV{LANG} "C") # Only ascii output
set (CTEST_BUILD_CONFIGURATION "Release")
set (CTEST_CMAKE_GENERATOR "Ninja")
# detect short sha
if(NOT DEFINED ENV{CI_COMMIT_SHORT_SHA})
execute_process(COMMAND git log -1 --pretty=format:%h
WORKING_DIRECTORY ${OTB_SOURCE_DIR}
OUTPUT_VARIABLE ci_short_sha)
else()
set(ci_short_sha "$ENV{CI_COMMIT_SHORT_SHA}")
endif()
# Find the build name and CI profile
set(ci_profile wip)
set(ci_mr_source "$ENV{CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}")
set(ci_mr_target "$ENV{CI_MERGE_REQUEST_TARGET_BRANCH_NAME}")
set(ci_mr_iid "$ENV{CI_MERGE_REQUEST_IID}")
set(ci_ref_name "$ENV{CI_COMMIT_REF_NAME}")
set (CTEST_BUILD_NAME "$ENV{CI_COMMIT_SHORT_SHA}")
set (CTEST_BUILD_NAME ${ci_short_sha})
if(ci_mr_source AND ci_mr_target AND ci_mr_iid)
set (CTEST_BUILD_NAME "${ci_mr_source} (MR ${ci_mr_iid})")
set(ci_profile mr)
......@@ -45,14 +54,26 @@ elseif(ci_ref_name)
endif()
endif()
#Warning, this variable is used in cdash_status.py. If change from
# ${IMAGE_NAME} to something else do not forget to change it.
# Detect site
if(NOT DEFINED IMAGE_NAME)
if(DEFINED ENV{IMAGE_NAME})
set(IMAGE_NAME $ENV{IMAGE_NAME})
endif()
endif()
set (CTEST_SITE "${IMAGE_NAME}")
# Directory variable
set (CTEST_SOURCE_DIRECTORY "${OTB_SOURCE_DIR}")
set (CTEST_BINARY_DIRECTORY "${OTB_SOURCE_DIR}/build/")
set (CTEST_INSTALL_DIRECTORY "${OTB_SOURCE_DIR}/install/")
if(BUILD_DIR)
set (CTEST_BINARY_DIRECTORY "${BUILD_DIR}")
else()
set (CTEST_BINARY_DIRECTORY "${OTB_SOURCE_DIR}/build/")
endif()
if(INSTALL_DIR)
set (CTEST_INSTALL_DIRECTORY "${INSTALL_DIR}")
else()
set (CTEST_INSTALL_DIRECTORY "${OTB_SOURCE_DIR}/install/")
endif()
set (PROJECT_SOURCE_DIR "${OTB_SOURCE_DIR}")
# Ctest command value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment