Skip to content

Commit 6181d03

Browse files
committed
fix: wait for medium e2e to finish and pass
Signed-off-by: Charlie Doern <[email protected]>
1 parent a479f0b commit 6181d03

File tree

3 files changed

+111
-10
lines changed

3 files changed

+111
-10
lines changed

.github/mergify.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,28 @@ pull_request_rules:
2424
- -files~=^\.github/(actions|workflows)/.*\.ya?ml$
2525
- -files~=^\.github/workflows/actionlint\.
2626

27+
# medium e2e workflow
28+
- or:
29+
- and:
30+
# note this should match the triggering criteria in 'e2e-nvidia-l4-x1.yml'
31+
- check-success~=e2e-medium-workflow-complete
32+
- or:
33+
- files~=\.py$
34+
- files=pyproject.toml
35+
- files=tox.ini
36+
- files=requirements.txt
37+
- files=requirements-dev.txt
38+
- files=constraints-dev.txt
39+
- files~=^\.github/workflows/.*\.yml$ # This workflow
40+
- and:
41+
- files~=\.py$
42+
- files=pyproject.toml
43+
- files=tox.ini
44+
- files=requirements.txt
45+
- files=requirements-dev.txt
46+
- files=constraints-dev.txt
47+
- files~=^\.github/workflows/.*\.yml$ # This workflow
48+
2749
# code lint workflow
2850
- or:
2951
- and:

.github/workflows/e2e-nvidia-l40s-x4-sdk.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ name: E2E (NVIDIA L40S x4) SDK Test
44

55
on:
66
# only run on PRs that touch certain regex paths
7-
pull_request:
7+
# only run on PRs that touch certain regex paths
8+
pull_request_target:
89
branches:
910
- main
11+
- release-*
1012
paths:
1113
# note this should match the merging criteria in 'mergify.yml'
1214
- "**.py"
@@ -15,20 +17,23 @@ on:
1517
- "requirements.txt"
1618
- "requirements-dev.txt"
1719
- "constraints-dev.txt"
18-
- ".github/workflows/e2e-nvidia-l40s-x4-sdk.yaml" # This workflow
19-
workflow_dispatch:
20-
inputs:
21-
pr_or_branch:
22-
description: 'pull request number or branch name'
23-
required: true
24-
default: 'main'
20+
- ".github/workflows/*.yml" # This workflow
21+
workflow_dispatch: {}
2522
concurrency:
2623
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
2724
cancel-in-progress: true
2825

2926
env:
3027
TMPDIR: /home/tmp
3128

29+
defaults:
30+
run:
31+
shell: bash
32+
33+
34+
permissions:
35+
contents: read
36+
3237
jobs:
3338
start-large-ec2-runner:
3439
runs-on: ubuntu-latest
@@ -97,8 +102,11 @@ jobs:
97102
- start-large-ec2-runner
98103
runs-on: ${{ needs.start-large-ec2-runner.outputs.label }}
99104

100-
permissions:
101-
pull-requests: write
105+
106+
# It is important that this job has no write permissions and has
107+
# no access to any secrets. This part (e2e-medium-test) is where we are running
108+
# untrusted code from PRs.
109+
permissions: {}
102110

103111
steps:
104112
- name: Install Packages
@@ -308,3 +316,14 @@ jobs:
308316
run: |
309317
echo "::warning::Failed to upload Phase 2 loss graph to S3. This won't block the workflow, but you may want to investigate."
310318
echo "Loss graph upload failed" >> "${GITHUB_STEP_SUMMARY}"
319+
320+
e2e-medium-workflow-complete:
321+
# we don't want to block PRs on failed EC2 cleanup
322+
# so not requiring "stop-medium-ec2-runner" as well
323+
permissions:
324+
checks: read
325+
uses: ./.github/workflows/status-checks.yml
326+
with:
327+
job_ids: >- # Space-separated job ids to wait on for status checks
328+
start-large-ec2-runner
329+
e2e-medium-test

.github/workflows/status-checks.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# yamllint disable rule:line-length
3+
4+
name: Status Checks Reusable Workflow
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
job_ids:
10+
description: 'Space-separated job ids to wait on for status checks'
11+
required: true
12+
type: string
13+
delay:
14+
description: 'Period in seconds to wait before first poll of GitHub Check Runs'
15+
required: false
16+
type: number
17+
default: 10
18+
interval:
19+
description: 'Interval or period in seconds between polling GitHub Check Runs'
20+
required: false
21+
type: number
22+
default: 10
23+
timeout:
24+
description: 'Timeout in seconds to complete polling GitHub Check Runs'
25+
required: false
26+
type: number
27+
default: 3600
28+
29+
env:
30+
LC_ALL: en_US.UTF-8
31+
32+
defaults:
33+
run:
34+
shell: bash
35+
36+
permissions:
37+
checks: read
38+
39+
jobs:
40+
status-checks:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: "Harden Runner"
44+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
45+
with:
46+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
47+
48+
- name: "Set status check variables"
49+
id: set_variables
50+
run: |
51+
jq -nr '[$ARGS.positional[] | split("\\s"; null) | map(select(. != ""))] | flatten | join("|") | ("match_pattern=(" + . + ")")' --args "${{ inputs.job_ids }}" >> "$GITHUB_OUTPUT"
52+
53+
- name: "Wait for status checks"
54+
uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0
55+
with:
56+
token: ${{ secrets.GITHUB_TOKEN }}
57+
match_pattern: ${{ steps.set_variables.outputs.match_pattern }}
58+
delay: ${{ inputs.delay }}
59+
interval: ${{ inputs.interval }}
60+
timeout: ${{ inputs.timeout }}

0 commit comments

Comments
 (0)