Fix Validate-dashboards CI: heredoc was redirecting itself to stdin (#773)

`echo "$response" | python3 - <<'PY' ... PY` redirected the heredoc
to python3's stdin (where it was correctly read as the script body), but
sys.stdin was then at EOF when the script called json.load(sys.stdin) —
so the assertion blew up with 'Expecting value: line 1 column 1' even
when Kibana's import had succeeded.

Pass the response via env var instead. The OSD ndjson import itself was
working all along (successCount: 26, success: true); only the assertion
step was broken, so master has been showing a red Validate-dashboards
run since the workflow was introduced.
This commit is contained in:
Sean Whalen
2026-05-20 09:38:15 -04:00
committed by GitHub
parent 2d3e896f6d
commit 8c5f63620c
+7 -3
View File
@@ -74,9 +74,13 @@ jobs:
-H 'kbn-xsrf: true' \
--form file=@dashboards/opensearch/opensearch_dashboards.ndjson)
echo "$response" | python3 -m json.tool
echo "$response" | python3 - <<'PY'
import json, sys
d = json.load(sys.stdin)
# Pass the response via env, not stdin: `python3 - <<EOF` (or bare
# heredoc) redirects the heredoc itself to stdin so sys.stdin is
# empty by the time the script runs, and json.load(sys.stdin) blows
# up with "Expecting value: line 1 column 1".
RESPONSE="$response" python3 <<'PY'
import json, os, sys
d = json.loads(os.environ["RESPONSE"])
if not d.get("success"):
sys.exit(f"Kibana import failed: {d}")
if d.get("errors"):