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
4848 COMMUNITY_GPU_EXECUTION_ENABLED : " false"
4949
5050concurrency :
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
5454jobs :
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