Skip to content

Commit d646e7e

Browse files
authored
Pin Nova job checkouts to the triggering commit, not the branch tip (#8413)
`ref: ${{ inputs.ref || github.ref }}` → `ref: ${{ inputs.ref }}` on the target-repo checkout in `linux_job_v2`, `linux_job_v3`, `macos_job`, `windows_job` (plus the stale `defaults to "nightly"` description on that input). A non-empty `ref` suppresses checkout's `commit = github.sha` defaulting, so the refspec resolves when the runner reaches the checkout step rather than when the run was triggered: commit A lands → run created for A → B and C land → the job builds C while the run and commit status say A. Same on `pull_request`, where GitHub regenerates `refs/pull/N/merge` whenever the head or base moves. Leaving `ref` empty restores upstream behavior — `github.ref` **and** `github.sha` — pinning the tree to the event SHA while still checking out a named branch. Passing `github.sha` directly would pin it too, but detaches HEAD and breaks branch-name-derived nightly versioning. `test-infra-ref` is unchanged. Same pattern remains in `linux_job.yml` (v1), `validate-domain-library.yml`, and `setup-build-test` — follow-up.
1 parent e86a82d commit d646e7e

6 files changed

Lines changed: 21 additions & 35 deletions

File tree

.github/workflows/linux_job_v2.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ on:
6060
default: ""
6161
type: string
6262
ref:
63-
description: 'Reference to checkout, defaults to "nightly"'
63+
description: 'Reference to checkout, defaults to the commit that triggered the workflow (github.sha)'
6464
default: ""
6565
type: string
6666
test-infra-repository:
@@ -199,7 +199,10 @@ jobs:
199199
with:
200200
# Support the use case where we need to checkout someone's fork
201201
repository: ${{ inputs.repository || github.repository }}
202-
ref: ${{ inputs.ref || github.ref }}
202+
# Leave this empty when the caller doesn't pin a ref. Checkout then
203+
# defaults to github.ref *and* github.sha, so the job can't drift onto
204+
# commits that landed after the run was triggered
205+
ref: ${{ inputs.ref }}
203206
single-branch: ${{ inputs.single-branch }}
204207
additional-fetch-refs: ${{ inputs.additional-fetch-refs }}
205208
path: ${{ inputs.repository || github.repository }}

.github/workflows/linux_job_v3.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ on:
6161
default: ""
6262
type: string
6363
ref:
64-
description: 'Reference to checkout, defaults to "nightly"'
64+
description: 'Reference to checkout, defaults to the commit that triggered the workflow (github.sha)'
6565
default: ""
6666
type: string
6767
test-infra-repository:
@@ -183,7 +183,10 @@ jobs:
183183
with:
184184
# Support the use case where we need to checkout someone's fork
185185
repository: ${{ inputs.repository || github.repository }}
186-
ref: ${{ inputs.ref || github.ref }}
186+
# Leave this empty when the caller doesn't pin a ref. Checkout then
187+
# defaults to github.ref *and* github.sha, so the job can't drift onto
188+
# commits that landed after the run was triggered
189+
ref: ${{ inputs.ref }}
187190
single-branch: ${{ inputs.single-branch }}
188191
additional-fetch-refs: ${{ inputs.additional-fetch-refs }}
189192
path: ${{ inputs.repository || github.repository }}

.github/workflows/macos_job.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ on:
4747
default: ""
4848
type: string
4949
ref:
50-
description: 'Reference to checkout, defaults to "nightly"'
50+
description: 'Reference to checkout, defaults to the commit that triggered the workflow (github.sha)'
5151
default: ""
5252
type: string
5353
test-infra-repository:
@@ -126,7 +126,10 @@ jobs:
126126
with:
127127
# Support the use case where we need to checkout someone's fork
128128
repository: ${{ inputs.repository || github.repository }}
129-
ref: ${{ inputs.ref || github.ref }}
129+
# Leave this empty when the caller doesn't pin a ref. Checkout then
130+
# defaults to github.ref *and* github.sha, so the job can't drift onto
131+
# commits that landed after the run was triggered
132+
ref: ${{ inputs.ref }}
130133
path: ${{ inputs.repository || github.repository }}
131134
fetch-depth: ${{ inputs.fetch-depth }}
132135
submodules: ${{ inputs.submodules }}

.github/workflows/test_linux_job_v2.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,6 @@ jobs:
5555
python3 -c 'import torch;cuda_avail = torch.cuda.is_available();print("CUDA available: " + str(cuda_avail));assert(cuda_avail)'
5656
python3 -c 'import torch;t = torch.ones([2,2], device="cuda:0");print(t);print("tensor device:" + str(t.device))'
5757
python3 -c 'import torch;assert(torch.version.cuda == "12.8")'
58-
test-gpu-containers:
59-
uses: ./.github/workflows/linux_job_v2.yml
60-
permissions:
61-
id-token: write
62-
strategy:
63-
matrix:
64-
runner_type: ["linux.aws.a100"]
65-
with:
66-
job-name: "linux-py3.10-cu121-container"
67-
runner: ${{ matrix.runner_type }}
68-
test-infra-repository: ${{ github.repository }}
69-
test-infra-ref: ${{ github.ref }}
70-
submodules: ${{ 'true' }}
71-
gpu-arch-type: cuda
72-
gpu-arch-version: "12.1"
73-
timeout: 60
74-
script: |
75-
nvidia-smi
76-
nvcc --version | grep "cuda_12.1"
77-
conda create --yes --quiet -n test python=3.10
78-
conda activate test
79-
python3 -m pip install --index-url https://download.pytorch.org/whl/nightly/cu121 --pre torch
80-
# Can import pytorch, cuda is available
81-
python3 -c 'import torch;cuda_avail = torch.cuda.is_available();print("CUDA available: " + str(cuda_avail));assert(cuda_avail)'
82-
python3 -c 'import torch;t = torch.ones([2,2], device="cuda:0");print(t);print("tensor device:" + str(t.device))'
83-
python3 -c 'import torch;assert(torch.version.cuda == "12.1")'
8458
test-docker-image:
8559
uses: ./.github/workflows/linux_job_v2.yml
8660
permissions:

.github/workflows/test_linux_job_v3.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
contents: read
5656
strategy:
5757
matrix:
58-
runner_type: ["mt-l-x86iavx512-11-125-a100"]
58+
runner_type: ["mt-l-x86aavx2-29-113-l4"]
5959
with:
6060
job-name: "linux-py3.10-cu128"
6161
runner: ${{ matrix.runner_type }}

.github/workflows/windows_job.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ on:
4747
default: ""
4848
type: string
4949
ref:
50-
description: 'Reference to checkout, defaults to "nightly"'
50+
description: 'Reference to checkout, defaults to the commit that triggered the workflow (github.sha)'
5151
default: ""
5252
type: string
5353
test-infra-repository:
@@ -118,7 +118,10 @@ jobs:
118118
with:
119119
# Support the use case where we need to checkout someone's fork
120120
repository: ${{ inputs.repository || github.repository }}
121-
ref: ${{ inputs.ref || github.ref }}
121+
# Leave this empty when the caller doesn't pin a ref. Checkout then
122+
# defaults to github.ref *and* github.sha, so the job can't drift onto
123+
# commits that landed after the run was triggered
124+
ref: ${{ inputs.ref }}
122125
path: ${{ inputs.repository || github.repository }}
123126
fetch-depth: ${{ inputs.fetch-depth }}
124127
submodules: ${{ inputs.submodules }}

0 commit comments

Comments
 (0)