From 88454f7440f44e491d2ed3b78a47522a58dcb9fd Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Mon, 29 Dec 2025 17:01:55 +0300 Subject: [PATCH 1/3] ci(workflow): fix runner affinity for e2e tests Add capture_runner job that captures the runner name and passes it to all downstream jobs via outputs. This ensures all e2e jobs run on the same self-hosted runner where the sandbox container exists. Problem: Jobs were distributed across multiple runners, causing "No such container" errors when test jobs tried to access the sandbox container created on a different runner. Solution: Use runner.name output to pin all related jobs to the same runner. Co-Authored-By: Claude Signed-off-by: Aleksei Sviridkin --- .github/workflows/pull-requests.yaml | 32 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index 2de01160..b5c07a74 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -141,15 +141,25 @@ jobs: core.setOutput('installer_id', installerId); core.setOutput('disk_id', diskId); + capture_runner: + name: "Capture runner" + runs-on: [self-hosted] + outputs: + runner_name: ${{ runner.name }} + needs: ["build", "resolve_assets"] + if: ${{ always() && (needs.build.result == 'success' || needs.resolve_assets.result == 'success') }} + steps: + - name: Capture runner name + run: echo "All e2e jobs will run on runner: ${{ runner.name }}" prepare_env: name: "Prepare environment" - runs-on: [self-hosted] + runs-on: ${{ needs.capture_runner.outputs.runner_name }} permissions: contents: read packages: read - needs: ["build", "resolve_assets"] - if: ${{ always() && (needs.build.result == 'success' || needs.resolve_assets.result == 'success') }} + needs: ["capture_runner"] + if: ${{ always() && needs.capture_runner.result == 'success' }} steps: # ▸ Checkout and prepare the codebase @@ -212,11 +222,11 @@ jobs: install_cozystack: name: "Install Cozystack" - runs-on: [self-hosted] + runs-on: ${{ needs.capture_runner.outputs.runner_name }} permissions: contents: read packages: read - needs: ["prepare_env", "resolve_assets"] + needs: ["capture_runner", "prepare_env", "resolve_assets"] if: ${{ always() && needs.prepare_env.result == 'success' }} steps: @@ -288,8 +298,8 @@ jobs: fail-fast: false matrix: ${{ fromJson(needs.detect_test_matrix.outputs.matrix) }} name: Test ${{ matrix.app }} - runs-on: [self-hosted] - needs: [install_cozystack,detect_test_matrix] + runs-on: ${{ needs.capture_runner.outputs.runner_name }} + needs: [capture_runner, install_cozystack, detect_test_matrix] if: ${{ always() && (needs.install_cozystack.result == 'success' && needs.detect_test_matrix.result == 'success') }} steps: @@ -312,8 +322,8 @@ jobs: collect_debug_information: name: Collect debug information - runs-on: [self-hosted] - needs: [test_apps] + runs-on: ${{ needs.capture_runner.outputs.runner_name }} + needs: [capture_runner, test_apps] if: ${{ always() }} steps: - name: Checkout code @@ -346,8 +356,8 @@ jobs: cleanup: name: Tear down environment - runs-on: [self-hosted] - needs: [collect_debug_information] + runs-on: ${{ needs.capture_runner.outputs.runner_name }} + needs: [capture_runner, collect_debug_information] if: ${{ always() && needs.test_apps.result == 'success' }} steps: From e67f8b678a33e2f3d73e51d51ef46499ed786bdd Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Mon, 29 Dec 2025 17:13:43 +0300 Subject: [PATCH 2/3] fix(ci): use multiline syntax for run command Fix YAML parsing error caused by colon in echo string. Co-Authored-By: Claude Signed-off-by: Aleksei Sviridkin --- .github/workflows/pull-requests.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index b5c07a74..2ab102f0 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -150,7 +150,8 @@ jobs: if: ${{ always() && (needs.build.result == 'success' || needs.resolve_assets.result == 'success') }} steps: - name: Capture runner name - run: echo "All e2e jobs will run on runner: ${{ runner.name }}" + run: | + echo "All e2e jobs will run on runner: ${{ runner.name }}" prepare_env: name: "Prepare environment" From 8f686a01e9665300b817132d7807241ed136c405 Mon Sep 17 00:00:00 2001 From: Aleksei Sviridkin Date: Mon, 29 Dec 2025 17:23:16 +0300 Subject: [PATCH 3/3] fix(ci): address CodeRabbit review comments - Add capture_runner.result check to collect_debug_information - Add test_apps to cleanup job needs array - Add capture_runner.result check to cleanup job Co-Authored-By: Claude Signed-off-by: Aleksei Sviridkin --- .github/workflows/pull-requests.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index 2ab102f0..82d26460 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -325,7 +325,7 @@ jobs: name: Collect debug information runs-on: ${{ needs.capture_runner.outputs.runner_name }} needs: [capture_runner, test_apps] - if: ${{ always() }} + if: ${{ always() && needs.capture_runner.result == 'success' }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -358,8 +358,8 @@ jobs: cleanup: name: Tear down environment runs-on: ${{ needs.capture_runner.outputs.runner_name }} - needs: [capture_runner, collect_debug_information] - if: ${{ always() && needs.test_apps.result == 'success' }} + needs: [capture_runner, collect_debug_information, test_apps] + if: ${{ always() && needs.capture_runner.result == 'success' && needs.test_apps.result == 'success' }} steps: - name: Checkout code