]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script: add a common ci_debug function to print ci debug lines
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 31 Oct 2022 19:06:25 +0000 (15:06 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 18 Feb 2025 22:58:08 +0000 (17:58 -0500)
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 <jmulligan@redhat.com>
(cherry picked from commit 93b94811cb10bb936c5abf87d708ae96d7939a8e)

src/script/lib-build.sh
src/script/run-make.sh

index 21da09eb62ddb34b4526acffefe06778ce825db6..a6ff447c99ee4eadbed311a3397f5abad90cb554 100644 (file)
@@ -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
+}
index 77bf57d6d96208b2fe6f1e4fd6f3b68fcc9cd8ee..3ab00861519d995ebdb02c7ab3c6dc174c6f17e9 100755 (executable)
@@ -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
 }