From e82c65a3c492ff06e79e21f9c07ee3938da7c72d Mon Sep 17 00:00:00 2001 From: TeTeHacko Date: Mon, 26 Oct 2026 18:26:35 +0100 Subject: [PATCH] dtrack-sbom: never fail the job when Dependency-Track is unreachable (v8) The runner starts composite bash steps with -e, while the script handles every failure itself and only warns. With dtrack.grg down, curl wrote no resp.json, the unguarded cat of it failed and -e ended the step with exit 1 before warn() ran - a failed build (meshcore-open run 29) instead of a warning. set +e restores the behaviour the script was written for. Checked with the step run under bash -e -o pipefail against an unreachable URL (was exit 1, now ::warning:: HTTP 000 and exit 0), a server answering 401 (warning, exit 0) and 200 (uploaded, token shown). Co-Authored-By: Claude Opus 5.5 --- README.md | 2 ++ dtrack-sbom/action.yml | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c52f48b..7a47feb 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ binary is verified by SHA-256. `v1` image gate + SBOM; `v2` fs scans, binary runtime, misconfig, gitleaks; `v3` gitleaks fetches the parent of a single commit in a depth-1 checkout (dispatch/cron runs scanned the whole tree as a root commit before). +`v8` dtrack-sbom really never fails the job: the runner's `bash -e` turned +an unreachable Dependency-Track into a failed build instead of a warning. Pinned tools (Trivy binary + image, gitleaks) are bumped by Renovate (tth/renovate). Its post-upgrade task `.gitea/update-checksums.sh` diff --git a/dtrack-sbom/action.yml b/dtrack-sbom/action.yml index 4c03afd..ee436da 100644 --- a/dtrack-sbom/action.yml +++ b/dtrack-sbom/action.yml @@ -49,7 +49,11 @@ runs: MIN: ${{ inputs.min-components }} TRIVY: ${{ inputs.trivy-image }} run: | - set -uo pipefail + # The runner starts composite bash steps with -e; this script handles + # every failure itself (warn, exit 0), so -e only turns an unguarded + # command into a failed job - e.g. the cat of a resp.json curl never + # wrote when Dependency-Track was unreachable. + set +e -uo pipefail warn() { echo "::warning::SBOM $PROJECT/$VERSION: $*"; exit 0; } [ -n "$REPORT" ] && [ -f "$REPORT" ] || warn "no report (gate skipped?)" [ -n "$DT_KEY" ] || warn "no API key"