Skip to content

Commit

Permalink
script: add a common ci_debug function to print ci debug lines
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
phlogistonjohn committed Feb 7, 2023
1 parent 9b7db75 commit 93b9481
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/script/lib-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
10 changes: 5 additions & 5 deletions src/script/run-make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit 93b9481

Please sign in to comment.