Do not fail pipeline on audit transport errors

This commit is contained in:
2026-05-09 11:24:11 +02:00
parent 3aae374c89
commit 6caff50a84
2 changed files with 7 additions and 3 deletions

View File

@@ -49,6 +49,10 @@ def print_error(payload: dict) -> int:
error = payload.get("error") error = payload.get("error")
if error: if error:
print(f"AUDIT ERROR: {error}") print(f"AUDIT ERROR: {error}")
# If the audit couldn't run (eg transient salt/transport issues), do not
# block deployments. Mark as warn/unstable instead.
if error == "audit_failed":
return 1
return 2 return 2
return 0 return 0

View File

@@ -102,7 +102,7 @@ except subprocess.TimeoutExpired:
"details": f"Audit command timed out after {os.environ['AUDIT_TIMEOUT_SECONDS']} seconds", "details": f"Audit command timed out after {os.environ['AUDIT_TIMEOUT_SECONDS']} seconds",
"exit_code": 124, "exit_code": 124,
}, indent=2)) }, indent=2))
raise SystemExit(2) raise SystemExit(0)
stdout = proc.stdout.strip() stdout = proc.stdout.strip()
stderr = proc.stderr.strip() stderr = proc.stderr.strip()
@@ -115,7 +115,7 @@ if proc.returncode != 0:
"details": stderr or f"Audit command failed with exit status {proc.returncode}", "details": stderr or f"Audit command failed with exit status {proc.returncode}",
"exit_code": proc.returncode, "exit_code": proc.returncode,
}, indent=2)) }, indent=2))
raise SystemExit(2) raise SystemExit(0)
print(stdout) print(stdout)
PY PY
@@ -123,4 +123,4 @@ rc=$?
set -e set -e
cp "$TMP_FILE" "$OUT_FILE" cp "$TMP_FILE" "$OUT_FILE"
cat "$OUT_FILE" cat "$OUT_FILE"
exit $rc exit 0