Skip to content

Commit be0d9b0

Browse files
committed
Adding a wrapper workflow to call the deploy tests
Signed-off-by: pvijayakrish <[email protected]>
1 parent 1334926 commit be0d9b0

File tree

2 files changed

+93
-2
lines changed

2 files changed

+93
-2
lines changed

.github/workflows/container-validation-backends.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ on:
99
- main
1010
- "pull-request/[0-9]+"
1111
- release/*.*.*
12-
workflow_dispatch:
12+
workflow_call:
1313
inputs:
1414
run_deploy_operator:
1515
description: 'Run deploy operator and deployment tests'
1616
required: false
17-
default: false
1817
type: boolean
18+
default: false
1919

2020
concurrency:
2121
# The group name is a ternary operation. If the ref_name is 'main',
@@ -25,9 +25,13 @@ concurrency:
2525
group: docker-build-test-${{ github.ref_name == 'main' && github.run_id || github.ref_name }}
2626
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
2727

28+
env_anchor: &secure_env
29+
environment: ${{ github.event_name == 'workflow_call' && 'protected-deploy' || '' }}
30+
2831
jobs:
2932
changed-files:
3033
runs-on: ubuntu-latest
34+
<<: *secure_env
3135
outputs:
3236
has_code_changes: ${{ steps.filter.outputs.has_code_changes }}
3337
steps:
@@ -41,6 +45,7 @@ jobs:
4145

4246
backend-status-check:
4347
runs-on: ubuntu-latest
48+
<<: *secure_env
4449
needs: [vllm, sglang, trtllm, operator]
4550
if: always()
4651
steps:
@@ -51,6 +56,7 @@ jobs:
5156
operator:
5257
needs: changed-files
5358
if: needs.changed-files.outputs.has_code_changes == 'true'
59+
<<: *secure_env
5460
strategy:
5561
fail-fast: false
5662
matrix:
@@ -131,6 +137,7 @@ jobs:
131137
vllm:
132138
needs: changed-files
133139
if: needs.changed-files.outputs.has_code_changes == 'true'
140+
<<: *secure_env
134141
strategy:
135142
fail-fast: false
136143
matrix:
@@ -200,6 +207,7 @@ jobs:
200207
sglang:
201208
needs: changed-files
202209
if: needs.changed-files.outputs.has_code_changes == 'true'
210+
<<: *secure_env
203211
strategy:
204212
fail-fast: false
205213
matrix:
@@ -267,6 +275,7 @@ jobs:
267275
trtllm:
268276
needs: changed-files
269277
if: needs.changed-files.outputs.has_code_changes == 'true'
278+
<<: *secure_env
270279
strategy:
271280
fail-fast: false
272281
matrix:
@@ -334,6 +343,7 @@ jobs:
334343
deploy-test-fault-tolerance:
335344
runs-on: cpu-amd-m5-2xlarge
336345
if: needs.changed-files.outputs.has_code_changes == 'true'
346+
<<: *secure_env
337347
needs: [changed-files, operator, vllm, trtllm, sglang]
338348
permissions:
339349
contents: read
@@ -477,6 +487,7 @@ jobs:
477487
# Upload metrics for this workflow and all its jobs
478488
upload-workflow-metrics:
479489
name: Upload Workflow Metrics
490+
<<: *secure_env
480491
runs-on: gitlab
481492
if: always() # Always run, even if other jobs fail
482493
needs: [backend-status-check] # Wait for the status check which waits for all build jobs
@@ -528,6 +539,7 @@ jobs:
528539
runs-on: cpu-amd-m5-2xlarge
529540
# TODO: Uncomment this when we have a way to test the deploy-operator job in CI.
530541
#if: needs.changed-files.outputs.has_code_changes == 'true'
542+
<<: *secure_env
531543
if: inputs.run_deploy_operator
532544
needs: [changed-files, operator, vllm, sglang, trtllm]
533545
env:
@@ -607,6 +619,7 @@ jobs:
607619
# TODO: Uncomment this when we have a way to test the deploy-test-vllm job in CI.
608620
#if: needs.changed-files.outputs.has_code_changes == 'true'
609621
if: inputs.run_deploy_operator
622+
<<: *secure_env
610623
needs: [changed-files, deploy-operator, vllm]
611624
permissions:
612625
contents: read
@@ -763,6 +776,7 @@ jobs:
763776
# TODO: Uncomment this when we have a way to test the deploy-test-sglang job in CI.
764777
#if: needs.changed-files.outputs.has_code_changes == 'true'
765778
if: inputs.run_deploy_operator
779+
<<: *secure_env
766780
needs: [changed-files, deploy-operator, sglang]
767781
permissions:
768782
contents: read
@@ -786,6 +800,7 @@ jobs:
786800
# TODO: Uncomment this when we have a way to test the deploy-test-trtllm job in CI.
787801
#if: needs.changed-files.outputs.has_code_changes == 'true'
788802
if: inputs.run_deploy_operator
803+
<<: *secure_env
789804
needs: [changed-files, deploy-operator, trtllm]
790805
permissions:
791806
contents: read
@@ -811,6 +826,7 @@ jobs:
811826
# TODO: Uncomment the below if statement when we have a way to test the cleanup job in CI.
812827
# if: always()
813828
if: inputs.run_deploy_operator
829+
<<: *secure_env
814830
needs: [changed-files, deploy-operator, deploy-test-trtllm, deploy-test-sglang, deploy-test-vllm]
815831
steps:
816832
- name: Output Node Name
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Trigger Secure Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
run_deploy_operator:
7+
description: 'Run deploy operator and deployment tests'
8+
required: false
9+
default: false
10+
type: boolean
11+
target_branch:
12+
description: 'Branch to run deploy tests on'
13+
required: false
14+
default: 'main'
15+
type: string
16+
17+
jobs:
18+
validate-access:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
authorized: ${{ steps.check.outputs.authorized }}
22+
steps:
23+
- name: Check User Authorization
24+
id: check
25+
run: |
26+
# Allow NVIDIA employees and approved bots
27+
allowed_actors=(
28+
"nvidia-employee1"
29+
"nvidia-employee2"
30+
"copy-pr-bot" # Allow the copy PR bot
31+
"nvidia-bot" # Allow other NVIDIA bots
32+
)
33+
34+
# Block external contributors
35+
blocked_patterns=(
36+
"external-"
37+
"contributor-"
38+
"guest-"
39+
)
40+
41+
actor="${{ github.actor }}"
42+
43+
# Check if actor is explicitly allowed
44+
for allowed in "${allowed_actors[@]}"; do
45+
if [[ "$actor" == "$allowed" ]]; then
46+
echo "authorized=true" >> $GITHUB_OUTPUT
47+
echo "✅ Authorized user: $actor"
48+
exit 0
49+
fi
50+
done
51+
52+
# Check if actor matches blocked patterns
53+
for pattern in "${blocked_patterns[@]}"; do
54+
if [[ "$actor" == *"$pattern"* ]]; then
55+
echo "❌ Blocked user pattern: $actor"
56+
echo "authorized=false" >> $GITHUB_OUTPUT
57+
exit 1
58+
fi
59+
done
60+
61+
# Default: block unknown users
62+
echo "❌ Unauthorized user: $actor"
63+
echo "authorized=false" >> $GITHUB_OUTPUT
64+
exit 1
65+
66+
trigger-deploy-tests:
67+
runs-on: ubuntu-latest
68+
needs: validate-access
69+
if: needs.validate-access.outputs.authorized == 'true'
70+
environment: protected-deploy # manual approval before triggering
71+
steps:
72+
- name: Call Secure Deploy Workflow
73+
uses: ./.github/workflows/container-validation-backends.yml
74+
with:
75+
run_deploy_operator: ${{ github.event.inputs.run_deploy_operator }}

0 commit comments

Comments
 (0)