From a56988150b99d26b01a49864781b17001d132ae8 Mon Sep 17 00:00:00 2001 From: Ruifeng Zheng Date: Thu, 14 May 2026 11:08:21 +0000 Subject: [PATCH] [INFRA] Pin downstream actions/checkout to a single resolved SHA Have the `precondition` job capture `git rev-parse HEAD` right after its `actions/checkout`, expose it as `head_sha`, and switch every downstream `actions/checkout` from `ref: ${{ inputs.branch }}` to `ref: ${{ needs.precondition.outputs.head_sha }}`. Without this, each downstream job independently re-resolves the branch tip at the moment it starts. Slow-to-start jobs (the `pyspark` matrix waits on `precompile` and typically begins ~17 minutes after the run is created) can pick up a newer commit than the one the compiled JAR they download was built from. When the intervening commit adds a tightly coupled change (new Spark Connect relation, new proto field, new server planner, new Python tests) the test job loads the new Python sources against an older JAR and every test fails with `[CONNECT_INVALID_PLAN.INVALID_ONE_OF_FIELD_NOT_SET]`. Generated-by: Claude Code (claude-opus-4-7) --- .github/workflows/build_and_test.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d722444379acd..308db6ad0f494 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -68,6 +68,8 @@ jobs: GITHUB_PREV_SHA: ${{ github.event.before }} outputs: required: ${{ steps.set-outputs.outputs.required }} + # Pinned so every downstream job checks out the same snapshot, even if `master` advances mid-run. + head_sha: ${{ steps.resolve-sha.outputs.head_sha }} image_url: ${{ steps.infra-image-outputs.outputs.image_url }} image_docs_url: ${{ steps.infra-image-docs-outputs.outputs.image_docs_url }} image_docs_url_link: ${{ steps.infra-image-link.outputs.image_docs_url_link }} @@ -84,6 +86,9 @@ jobs: fetch-depth: 0 repository: apache/spark ref: ${{ inputs.branch }} + - name: Resolve apache/spark HEAD SHA + id: resolve-sha + run: echo "head_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Sync the current branch with the latest in Apache Spark if: github.repository != 'apache/spark' run: | @@ -349,7 +354,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Sync the current branch with the latest in Apache Spark if: github.repository != 'apache/spark' run: | @@ -467,7 +472,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Sync the current branch with the latest in Apache Spark if: github.repository != 'apache/spark' run: | @@ -561,7 +566,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Sync the current branch with the latest in Apache Spark if: github.repository != 'apache/spark' run: | @@ -683,7 +688,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Add GITHUB_WORKSPACE to git trust safe.directory run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} @@ -833,7 +838,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Add GITHUB_WORKSPACE to git trust safe.directory run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} @@ -922,7 +927,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Sync the current branch with the latest in Apache Spark if: github.repository != 'apache/spark' run: | @@ -984,7 +989,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Add GITHUB_WORKSPACE to git trust safe.directory run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} @@ -1183,7 +1188,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Add GITHUB_WORKSPACE to git trust safe.directory run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} @@ -1383,7 +1388,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Sync the current branch with the latest in Apache Spark if: github.repository != 'apache/spark' run: | @@ -1500,7 +1505,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Sync the current branch with the latest in Apache Spark if: github.repository != 'apache/spark' run: | @@ -1568,7 +1573,7 @@ jobs: with: fetch-depth: 0 repository: apache/spark - ref: ${{ inputs.branch }} + ref: ${{ needs.precondition.outputs.head_sha }} - name: Sync the current branch with the latest in Apache Spark if: github.repository != 'apache/spark' run: |