Skip to content

Commit fa05a1b

Browse files
authored
ci: restrict Stable result publication to main (#1341)
* ci: restrict Stable result publication to main Manual Dev comparisons must not replace the complete Stable verdict with a CPU-only compatibility result after GPU promotion. Authorize each publisher before any status write, including failure handling. Refs: #1301 Signed-off-by: yifeif <277870278+yifeif-nv@users.noreply.github.com> * ci: keep Community coordination on main Signed-off-by: yifeif <277870278+yifeif-nv@users.noreply.github.com> --------- Signed-off-by: yifeif <277870278+yifeif-nv@users.noreply.github.com>
1 parent e48814b commit fa05a1b

3 files changed

Lines changed: 317 additions & 25 deletions

File tree

.github/community-ci.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,22 @@ The switch is captured once per request. Turning it off stops Dev on subsequent
5858
requests; work already started finishes normally. A Dev branch selection alone
5959
does not enable automatic dual running. Dev must not be a required merge check.
6060

61-
For manual qualification, select **Actions > Community CI > Run workflow** and
62-
enter a PR number. Selecting `ci/developer` runs Dev against the existing Stable
63-
PR snapshot; with dual running enabled it also publishes the paired Stable result.
64-
Selecting `main` manually starts Stable and, when enabled, Dev. Keep the internal
65-
snapshot, lane, and request inputs at their defaults. Manual starts require
61+
For manual qualification, select **Actions > Community CI > Run workflow**,
62+
keep the workflow branch set to `main`, and enter a PR number. Select `ci_lane=dev`
63+
to run Dev only against the existing Stable PR snapshot, regardless of the
64+
dual-run switch. The default `ci_lane=stable` starts Stable and, when enabled, Dev.
65+
Keep the internal snapshot and request inputs empty. Manual starts require
6666
maintain or admin access. `run_gpu_smoke` retains the existing manual GPU opt-in.
6767

68+
Coordination and status publication run only from `refs/heads/main`. Dev's
69+
implementation ref is data selected by `TRTMC_COMMUNITY_CI_DEV_REF`, not the
70+
workflow ref used to start the coordinator. Direct Dev-branch starts without the
71+
internal snapshot do not run coordination jobs. Only the main coordinator
72+
publishes `Stable Community CI`.
73+
A Dev-only start cannot replace a failed or pending Stable result with the
74+
successful CPU compatibility check retained for Internal CI. Apply this publisher
75+
guard to the Dev branch before promoting its GPU implementation to `main`.
76+
6877
## Dev GPU experiment
6978

7079
GPU policy is versioned in the workflow, independently of the dual-run switch.
@@ -81,8 +90,9 @@ timm ViT, Whisper, and directly changed or added families. Docs-only changes
8190
skip GPU. Missing public assets fail visibly rather than count as coverage.
8291

8392
The existing `gpu-ci-dispatch` environment permits `main` and protected
84-
`ci/developer`. Only administrators may update the latter. Additional CI refs
85-
need protection and environment approval. Dev uses a disposable Brev instance,
93+
`ci/developer`. Only administrators may update the latter. The dispatcher accepts
94+
only `main` and `ci/developer`; additional refs need an explicit allowlist update,
95+
protection, and environment approval. Dev uses a disposable Brev instance,
8696
with cleanup in the job and an independent cleanup job. Per-PR and per-lane
8797
concurrency keeps independent PRs parallel; shared provider quota can still
8898
prevent allocation. Dev GPU type and CUDA architecture default to L40 and 89.

.github/workflows/community-ci.yml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
default: false
2828
type: boolean
2929
ci_lane:
30-
description: CI implementation role (filled automatically)
30+
description: Select dev for a manual Dev-only run; stable follows the dual-run switch
3131
required: false
3232
type: choice
3333
default: stable
@@ -48,14 +48,15 @@ env:
4848
COMMUNITY_GPU_EXECUTION_ENABLED: "false"
4949

5050
concurrency:
51-
group: community-ci-${{ inputs.source_snapshot != '' && inputs.ci_lane || github.event_name == 'pull_request' && 'stable-pr' || github.ref_name == 'main' && 'start-main' || 'start-dev' }}-${{ github.event.pull_request.number || inputs.pr_number }}
51+
group: community-ci-${{ inputs.source_snapshot != '' && inputs.ci_lane || github.event_name == 'pull_request' && 'stable-pr' || (github.event_name == 'workflow_dispatch' && inputs.ci_lane == 'dev') && 'start-dev' || 'start-main' }}-${{ github.event.pull_request.number || inputs.pr_number }}
5252
cancel-in-progress: true
5353

5454
jobs:
5555
snapshot:
5656
name: Capture the Community CI snapshot
5757
if: >-
5858
github.repository == 'NVIDIA/TensorRT-Model-Connect' &&
59+
github.ref == 'refs/heads/main' &&
5960
(github.event_name == 'pull_request_target' ||
6061
(github.event_name == 'workflow_dispatch' && inputs.source_snapshot == ''))
6162
runs-on: ubuntu-24.04
@@ -76,14 +77,17 @@ jobs:
7677
id: lanes
7778
env:
7879
DUAL_RUN: ${{ vars.TRTMC_COMMUNITY_CI_DUAL_RUN }}
79-
CI_BRANCH: ${{ github.ref_name }}
80+
CI_ENTRY_REF: ${{ github.ref }}
81+
EVENT_NAME: ${{ github.event_name }}
82+
REQUESTED_LANE: ${{ inputs.ci_lane }}
8083
run: |
8184
set -euo pipefail
85+
test "$CI_ENTRY_REF" = refs/heads/main
8286
lanes='["stable"]'
83-
if [ "$DUAL_RUN" = true ]; then
84-
lanes='["stable","dev"]'
85-
elif [ "$CI_BRANCH" != main ]; then
87+
if [ "$EVENT_NAME" = workflow_dispatch ] && [ "$REQUESTED_LANE" = dev ]; then
8688
lanes='["dev"]'
89+
elif [ "$DUAL_RUN" = true ]; then
90+
lanes='["stable","dev"]'
8791
fi
8892
echo "lanes=$lanes" >> "$GITHUB_OUTPUT"
8993
@@ -102,7 +106,7 @@ jobs:
102106
103107
- name: Find the existing Stable PR snapshot
104108
id: stable
105-
if: ${{ github.event_name == 'pull_request_target' || github.ref_name != 'main' }}
109+
if: ${{ github.event_name == 'pull_request_target' || inputs.ci_lane == 'dev' }}
106110
env:
107111
GH_TOKEN: ${{ github.token }}
108112
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
@@ -191,7 +195,7 @@ jobs:
191195
env:
192196
GH_TOKEN: ${{ github.token }}
193197
HEAD_SHA: ${{ steps.snapshot.outputs.head_sha }}
194-
STATUS_CONTEXT: ${{ github.ref_name == 'main' && 'Stable Community CI' || 'Dev Community CI' }}
198+
STATUS_CONTEXT: ${{ steps.lanes.outputs.lanes == '["dev"]' && 'Dev Community CI' || 'Stable Community CI' }}
195199
run: |
196200
set -euo pipefail
197201
[[ "$HEAD_SHA" =~ ^[0-9a-f]{40}$ ]] || exit 0
@@ -204,7 +208,7 @@ jobs:
204208
dispatch:
205209
name: Start ${{ matrix.lane }} Community CI
206210
needs: snapshot
207-
if: ${{ needs.snapshot.result == 'success' }}
211+
if: ${{ needs.snapshot.result == 'success' && github.ref == 'refs/heads/main' }}
208212
strategy:
209213
fail-fast: false
210214
matrix:
@@ -222,6 +226,26 @@ jobs:
222226
env:
223227
STATUS_CONTEXT: ${{ matrix.lane == 'stable' && 'Stable Community CI' || 'Dev Community CI' }}
224228
steps:
229+
- name: Authorize the result publisher
230+
id: publisher
231+
env:
232+
LANE: ${{ matrix.lane }}
233+
CI_ENTRY_REF: ${{ github.ref }}
234+
run: |
235+
set -euo pipefail
236+
if [ "$CI_ENTRY_REF" != refs/heads/main ]; then
237+
echo "::error::Community CI coordination must run from main."
238+
exit 1
239+
fi
240+
case "$LANE" in
241+
stable)
242+
test "$STATUS_CONTEXT" = 'Stable Community CI'
243+
;;
244+
dev) test "$STATUS_CONTEXT" = 'Dev Community CI' ;;
245+
*) echo "::error::Unknown Community CI publisher."; exit 1 ;;
246+
esac
247+
echo "authorized=true" >> "$GITHUB_OUTPUT"
248+
225249
- name: Mark the selected CI pending
226250
env:
227251
GH_TOKEN: ${{ github.token }}
@@ -239,14 +263,18 @@ jobs:
239263
env:
240264
GH_TOKEN: ${{ github.token }}
241265
PR_NUMBER: ${{ needs.snapshot.outputs.pr_number }}
242-
CI_REF: ${{ matrix.lane == 'stable' && 'main' || github.ref_name != 'main' && github.ref_name || vars.TRTMC_COMMUNITY_CI_DEV_REF || 'main' }}
266+
CI_REF: ${{ matrix.lane == 'stable' && 'main' || vars.TRTMC_COMMUNITY_CI_DEV_REF || 'main' }}
243267
LANE: ${{ matrix.lane }}
244268
SOURCE_SNAPSHOT: ${{ needs.snapshot.outputs.source_snapshot }}
245269
HEAD_SHA: ${{ needs.snapshot.outputs.head_sha }}
246270
STABLE_RUN_ID: ${{ needs.snapshot.outputs.stable_run_id }}
247271
RUN_GPU_SMOKE: ${{ inputs.run_gpu_smoke || false }}
248272
run: |
249273
set -euo pipefail
274+
case "$LANE:$CI_REF" in
275+
stable:main|dev:main|dev:ci/developer) ;;
276+
*) echo "::error::The CI implementation must use an approved main or ci/developer branch."; exit 1 ;;
277+
esac
250278
if [ "$LANE" = stable ] && [ -n "${STABLE_RUN_ID:-}" ]; then
251279
[[ "$STABLE_RUN_ID" =~ ^[1-9][0-9]*$ ]]
252280
echo "run_id=$STABLE_RUN_ID" >> "$GITHUB_OUTPUT"
@@ -349,7 +377,7 @@ jobs:
349377
exit 1
350378
351379
- name: Report a failed CI request
352-
if: ${{ failure() && steps.verdict.outputs.reported != 'true' }}
380+
if: ${{ failure() && steps.publisher.outputs.authorized == 'true' && steps.verdict.outputs.reported != 'true' }}
353381
env:
354382
GH_TOKEN: ${{ github.token }}
355383
HEAD_SHA: ${{ needs.snapshot.outputs.head_sha }}

0 commit comments

Comments
 (0)