Fix GCP operator runner path initialization
This commit is contained in:
parent
15bfd831de
commit
c97952b88e
2 changed files with 23 additions and 2 deletions
11
.github/workflows/gcp-iap-operator.yml
vendored
11
.github/workflows/gcp-iap-operator.yml
vendored
|
|
@ -36,8 +36,6 @@ env:
|
||||||
CLONE_SERVICE_ACCOUNT: sa-teleo-iap-clone-operator@teleo-501523.iam.gserviceaccount.com
|
CLONE_SERVICE_ACCOUNT: sa-teleo-iap-clone-operator@teleo-501523.iam.gserviceaccount.com
|
||||||
EXPECTED_WORKFLOW_REF: living-ip/teleo-infrastructure/.github/workflows/gcp-iap-operator.yml@refs/heads/main
|
EXPECTED_WORKFLOW_REF: living-ip/teleo-infrastructure/.github/workflows/gcp-iap-operator.yml@refs/heads/main
|
||||||
DISPATCHER_VERSION: teleo-gcp-iap-operator-v1
|
DISPATCHER_VERSION: teleo-gcp-iap-operator-v1
|
||||||
BUNDLE_DIR: ${{ runner.temp }}/gcp-iap-operator-bundle
|
|
||||||
RESULT_DIR: ${{ runner.temp }}/gcp-iap-operator-result
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
operate:
|
operate:
|
||||||
|
|
@ -48,6 +46,15 @@ jobs:
|
||||||
- name: Check out the dispatched main revision
|
- name: Check out the dispatched main revision
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Initialize runner-local paths
|
||||||
|
id: paths
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
[[ -n "${RUNNER_TEMP:-}" ]] || exit 2
|
||||||
|
printf 'BUNDLE_DIR=%s\n' "${RUNNER_TEMP}/gcp-iap-operator-bundle" >> "${GITHUB_ENV}"
|
||||||
|
printf 'RESULT_DIR=%s\n' "${RUNNER_TEMP}/gcp-iap-operator-result" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
- name: Validate fixed inputs and select identity
|
- name: Validate fixed inputs and select identity
|
||||||
id: validate
|
id: validate
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,20 @@ def test_workflow_uses_wif_official_actions_and_sanitized_short_retention() -> N
|
||||||
assert validate_index < auth_index
|
assert validate_index < auth_index
|
||||||
|
|
||||||
|
|
||||||
|
def test_workflow_initializes_runner_paths_at_step_runtime() -> None:
|
||||||
|
workflow = load_workflow()
|
||||||
|
assert "BUNDLE_DIR" not in workflow["env"]
|
||||||
|
assert "RESULT_DIR" not in workflow["env"]
|
||||||
|
steps = workflow["jobs"]["operate"]["steps"]
|
||||||
|
paths_index = next(i for i, step in enumerate(steps) if step.get("id") == "paths")
|
||||||
|
validate_index = next(i for i, step in enumerate(steps) if step.get("id") == "validate")
|
||||||
|
paths_source = steps[paths_index]["run"]
|
||||||
|
assert paths_index < validate_index
|
||||||
|
assert '"${RUNNER_TEMP}/gcp-iap-operator-bundle" >> "${GITHUB_ENV}"' in paths_source
|
||||||
|
assert '"${RUNNER_TEMP}/gcp-iap-operator-result" >> "${GITHUB_ENV}"' in paths_source
|
||||||
|
assert "runner.temp" not in WORKFLOW.read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
def test_workflow_builds_exact_main_bundle_from_tracked_files_and_hashes() -> None:
|
def test_workflow_builds_exact_main_bundle_from_tracked_files_and_hashes() -> None:
|
||||||
source = WORKFLOW.read_text(encoding="utf-8")
|
source = WORKFLOW.read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue