From 7f39a4e1cae74c7e4cc919ff762ac76b4bdc8bf5 Mon Sep 17 00:00:00 2001 From: Bruno Bernardo Date: Mon, 15 Dec 2025 19:29:32 +0100 Subject: [PATCH 1/3] CI/Scripts: enable [dune] cache stats for [schedule] or [api] pipelines Instead of just scheduled pipelines. --- scripts/ci/dune.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/dune.sh b/scripts/ci/dune.sh index 246f5e5d51bf..d06ed4f07d9a 100755 --- a/scripts/ci/dune.sh +++ b/scripts/ci/dune.sh @@ -5,8 +5,8 @@ set -e # This script wraps dune to compute and report cache hit ratio in CI when DUNE_CACHE_INFO=true. # It analyzes dune's cache debug output to show how many files were restored vs rebuilt. -# Set DUNE_CACHE_INFO to "true" if we are in a CI scheduled pipeline -if [ -n "$TZ_SCHEDULE_KIND" ]; then +# Set DUNE_CACHE_INFO to "true" if the CI pipeline is scheduled or triggered via api +if [ "$CI_PIPELINE_SOURCE" = "schedule" ] || [ "$CI_PIPELINE_SOURCE" = "api" ]; then DUNE_CACHE_INFO="true" fi -- GitLab From f85721c2adc2ca12c191af47410698c1d37e3568 Mon Sep 17 00:00:00 2001 From: Bruno Bernardo Date: Mon, 15 Dec 2025 19:33:29 +0100 Subject: [PATCH 2/3] CI/Scripts: dune cache hit rate as a float btw 0 and 1 Instead of a percentage. More flexible, more precise. --- scripts/ci/dune.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ci/dune.sh b/scripts/ci/dune.sh index d06ed4f07d9a..dc76b471a64d 100755 --- a/scripts/ci/dune.sh +++ b/scripts/ci/dune.sh @@ -63,15 +63,15 @@ if [ -f "${CACHE_DEBUG_LOG}" ]; then TOTAL_OPS=$((CACHE_HITS + FS_MISS)) if [ ${TOTAL_OPS} -gt 0 ]; then - HIT_RATIO=$(awk -v h="${CACHE_HITS}" -v t="${TOTAL_OPS}" 'BEGIN { printf "%.2f", (h / t) * 100 }') + HIT_RATIO=$(awk -v h="${CACHE_HITS}" -v t="${TOTAL_OPS}" 'BEGIN { printf "%f", (h / t) }') else - HIT_RATIO="0.00" + HIT_RATIO="0." fi else CACHE_HITS=0 FS_MISS=0 TOTAL_OPS=0 - HIT_RATIO="0.00" + HIT_RATIO="0." fi echo @@ -80,7 +80,7 @@ echo "Cache hit ratio analysis:" printf " Files restored from cache: %s\n" "${CACHE_HITS}" printf " Files built (cache miss): %s\n" "${FS_MISS}" printf " Total operations: %s\n" "${TOTAL_OPS}" -printf " Cache hit ratio: %s%%\n" "${HIT_RATIO}" +printf " Cache hit ratio: %s\n" "${HIT_RATIO}" echo "---------------------------------------------------------------" echo -- GitLab From 080e8bb6b6f9d9c4df13210832b612bd25e9686b Mon Sep 17 00:00:00 2001 From: Bruno Bernardo Date: Mon, 15 Dec 2025 19:52:45 +0100 Subject: [PATCH 3/3] CI/Scripts: info in log when DUNE_CACHE_INFO disabled --- scripts/ci/dune.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/dune.sh b/scripts/ci/dune.sh index dc76b471a64d..052d778f0937 100755 --- a/scripts/ci/dune.sh +++ b/scripts/ci/dune.sh @@ -13,6 +13,7 @@ fi # Check if DUNE_CACHE_INFO is set to "true" # If not, just run dune build normally without cache reporting if [ "${DUNE_CACHE_INFO}" != "true" ]; then + echo "dune cache stats (via [dune.sh]) disabled" dune "$@" exit $? fi -- GitLab