Skip to content

Commit d248b4b

Browse files
committed
Pin Nova job checkouts to the triggering commit, not the branch tip
The job templates passed `ref: ${{ inputs.ref || github.ref }}` to checkout. A non-empty ref suppresses checkout's own `commit = github.sha` defaulting, so the fetch refspec resolved to whatever the ref pointed at when the runner got to the checkout step -- not what triggered the run. Commits landing during queue time were silently picked up and the results attributed to the older SHA. Leaving `ref` empty lets checkout default to github.ref *and* github.sha, which pins the tree to the event SHA while still checking out a named branch (passing github.sha directly would detach HEAD and break nightly versioning). test-infra-ref is deliberately unchanged.
1 parent ca5f51e commit d248b4b

4 files changed

Lines changed: 20 additions & 8 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/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)