ci: avoid heredoc in unit tests coverage export

This commit is contained in:
Brad Stein 2026-04-05 14:14:23 -03:00
parent fd6c460c2f
commit 72f7e6941f

7
Jenkinsfile vendored
View File

@ -124,12 +124,7 @@ spec:
coverage="$(go tool cover -func=build/coverage.out | awk '/^total:/ {gsub("%","",$3); print $3}')"
fi
export GO_COVERAGE="${coverage}"
python3 - <<'"'"'PY'"'"'
import json, os
coverage = float(os.environ.get("GO_COVERAGE", "0") or "0")
with open("build/coverage.json", "w", encoding="utf-8") as handle:
json.dump({"summary": {"percent_covered": coverage}}, handle)
PY
printf '{"summary":{"percent_covered":%s}}\n' "${GO_COVERAGE}" > "${COVERAGE_JSON}"
exit ${test_rc}
'''
}