From 141899fb9eb249006577120c92eda4870296634d Mon Sep 17 00:00:00 2001 From: Julien Carsique Date: Fri, 5 Jun 2026 17:45:42 +0200 Subject: [PATCH] BUILD-11444 Replace decision file gate with CI_METRICS_ENABLED env var The post-job completion hook no longer checks for the presence of ${CI_METRICS_DIR}/enabled. It now reads $CI_METRICS_ENABLED which is written to $GITHUB_ENV by the pre-job hook (job-started.sh). Companion changes in github-runners-infra, ci-ami-images, and gh-action_cache. Co-Authored-By: Claude Sonnet 4.6 --- ci-metrics/job-completed.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ci-metrics/job-completed.sh b/ci-metrics/job-completed.sh index 822a80ab..efe12d5b 100755 --- a/ci-metrics/job-completed.sh +++ b/ci-metrics/job-completed.sh @@ -5,9 +5,7 @@ # metrics table to $GITHUB_STEP_SUMMARY. # Fail-open: any error → exit 0 without breaking the job. # -# Feature flag (presence-only file written by job-started.sh; may also be touched/removed by GitHub actions (i.e. gh-action_cache) to honour -# a workflow-env override: -# ${CI_METRICS_DIR}/enabled no-op early exit unless this file exists +# Feature flag: CI_METRICS_ENABLED=true written to $GITHUB_ENV by job-started.sh; no-op early exit unless this env var is true. # # Env overrides (used by tests; do not set in production): # CI_METRICS_CGROUP_ROOT default /sys/fs/cgroup (mount root) @@ -33,14 +31,12 @@ log() { } # ---------- Feature flag ---------- -gate_file="${CI_METRICS_DIR:-/tmp/ci-metrics}/enabled" -if [[ -e "$gate_file" ]]; then - log "collecting metrics (gate: ${gate_file} present)" +if [[ "${CI_METRICS_ENABLED:-false}" == "true" ]]; then + log "collecting metrics (CI_METRICS_ENABLED=true)" else - log "skipped: ${gate_file} is absent" + log "skipped: CI_METRICS_ENABLED is not true (value: ${CI_METRICS_ENABLED:-})" exit 0 fi -unset gate_file # ---------- Paths ---------- CGROUP_ROOT="${CI_METRICS_CGROUP_ROOT:-/sys/fs/cgroup}"