diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 804bfc30b..03105df22 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -384,7 +384,6 @@ jobs: contents: read env: ARCH: ${{ matrix.arch }} - XDG_STATE_HOME: ${{ runner.temp }}/state AGENT_ENV_DOCUMENT_STORE: local AGENT_ENV_OBJECT_STORE: local steps: @@ -414,7 +413,10 @@ jobs: docker run --detach --name registry --publish 5000:5000 \ --volume "$RUNNER_TEMP/computers/registry:/var/lib/registry" mirror.gcr.io/library/registry:2 timeout 30 sh -c 'until curl -sf http://localhost:5000/v2/ >/dev/null; do sleep 1; done' + # The runner context is a step's, not a job's. - name: Compose and probe + env: + XDG_STATE_HOME: ${{ runner.temp }}/state run: | "$RUNNER_TEMP/venv/bin/python" .github/scripts/release_computers.py compose "$ARCH" \ "$RUNNER_TEMP/computers/composed" diff --git a/tst/unit/test_release_infra_images.py b/tst/unit/test_release_infra_images.py index db7f189a2..b8c092359 100644 --- a/tst/unit/test_release_infra_images.py +++ b/tst/unit/test_release_infra_images.py @@ -50,6 +50,33 @@ def _finished(job: str) -> str: return f"""contains(fromJSON('["success", "skipped"]'), needs.{job}.result)""" +# What a job's own env can read; a step's can read the runner too (docs.github.com, "Context availability"). +_JOB_ENV_CONTEXTS = {"github", "inputs", "matrix", "needs", "secrets", "strategy", "vars"} + + +def _job_env_contexts(jobs: dict) -> set[tuple[str, str]]: + """Each (job, context) a job's own env reads: in each of its expressions, with their quoted strings left out, every + name that opens a property path, not one that follows a dot or is part of a hyphened id (``needs.infra-plan``).""" + return {(name, context) for name, body in jobs.items() for value in (body.get("env") or {}).values() + for expression in re.findall(r"\$\{\{(.*?)\}\}", str(value)) + for context in re.findall(r"(?