From 29da3e654d0f73ac52626c7e2532b996fa4b925b Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 31 Oct 2022 15:06:25 -0400 Subject: [PATCH] script: add a common ci_debug function to print ci debug lines Reduces some of the boilerplate around emitting the "CI_DEBUG:" prefixed debug lines for the CI. Additionally, enables using the FORCE_CI_DEBUG var to enable ci debug lines even when not in a jenkins environment. Signed-off-by: John Mulligan (cherry picked from commit 93b94811cb10bb936c5abf87d708ae96d7939a8e) --- src/script/lib-build.sh | 6 ++++++ src/script/run-make.sh | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/script/lib-build.sh b/src/script/lib-build.sh index 21da09eb62ddb..a6ff447c99ee4 100644 --- a/src/script/lib-build.sh +++ b/src/script/lib-build.sh @@ -25,3 +25,9 @@ _SOURCED_LIB_BUILD=1 function in_jenkins() { [ -n "$JENKINS_HOME" ] } + +function ci_debug() { + if in_jenkins || [ "${FORCE_CI_DEBUG}" ]; then + echo "CI_DEBUG: $*" + fi +} diff --git a/src/script/run-make.sh b/src/script/run-make.sh index 77bf57d6d9620..3ab00861519d9 100755 --- a/src/script/run-make.sh +++ b/src/script/run-make.sh @@ -68,7 +68,7 @@ function prepare() { fi if test -f ./install-deps.sh ; then - in_jenkins && echo "CI_DEBUG: Running install-deps.sh" + ci_debug "Running install-deps.sh" INSTALL_EXTRA_PACKAGES="ccache git $which_pkg clang" $DRY_RUN source ./install-deps.sh || return 1 trap clean_up_after_myself EXIT @@ -134,9 +134,9 @@ EOM cmake_opts+=$(detect_ceph_dev_pkgs) - in_jenkins && echo "CI_DEBUG: Our cmake_opts are: $cmake_opts - CI_DEBUG: Running ./configure" - in_jenkins && echo "CI_DEBUG: Running do_cmake.sh" + ci_debug "Our cmake_opts are: $cmake_opts" + ci_debug "Running ./configure" + ci_debug "Running do_cmake.sh" $DRY_RUN ./do_cmake.sh $cmake_opts $@ || return 1 } @@ -154,7 +154,7 @@ function build() { BUILD_MAKEOPTS=${BUILD_MAKEOPTS:-$DEFAULT_MAKEOPTS} test "$BUILD_MAKEOPTS" && echo "make will run with option(s) $BUILD_MAKEOPTS" # older cmake does not support --parallel or -j, so pass it to underlying generator - in_jenkins && echo "CI_DEBUG: Running cmake" + ci_debug "Running cmake" $DRY_RUN cmake --build . $targets -- $BUILD_MAKEOPTS || return 1 $DRY_RUN ccache -s # print the ccache statistics to evaluate the efficiency } -- 2.39.5