The CI currently inherits almost all env vars from the host. This was problematic in the past and causing non-determinism, e.g. the fix in commit fa12558d21aa03c22407a1458a0345d8a7ab6a4b. It is still problematic today, see e.g. #31349 (comment), or #32935
This fixes #32935 by only passing env vars documented in ./ci/test/00_setup_env.sh
.
Implementation-wise, instead of cramming the python code into the python -c ""
statement, just start a fresh py file, which is easier to handle.