Skip to content

Commit 33f1d88

Browse files
authored
Merge pull request #726 from stackhpc/wallaby-ci-path-filter
CI: Skip aio jobs based on changed files
2 parents dae64dd + 57021fe commit 33f1d88

File tree

4 files changed

+84
-6
lines changed

4 files changed

+84
-6
lines changed

.github/path-filters.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This file is a list of path filters for the PR workflow in .github/workflows/stackhpc-pull-request.yml.
2+
aio:
3+
- '.automation'
4+
- '.automation.conf/config.sh'
5+
- '.automation.conf/tempest/load-lists/default'
6+
- '.automation.conf/tempest/load-lists/platform.2022.11-test-list.txt'
7+
- '.automation.conf/tempest/load-lists/refstack-2019.11-test-list.txt'
8+
- '.automation.conf/tempest/tempest-ci-aio.overrides.conf'
9+
- '.github/workflows/stackhpc-all-in-one.yml'
10+
- '.github/workflows/stackhpc-build-kayobe-image.yml'
11+
- '.github/workflows/stackhpc-pull-request.yml'
12+
- 'etc/kayobe/*.yml'
13+
- 'etc/kayobe/ansible/configure-aio-resources.yml'
14+
- 'etc/kayobe/ansible/growroot.yml'
15+
- 'etc/kayobe/ansible/requirements.yml'
16+
- 'etc/kayobe/ansible/scripts/aio-init.sh'
17+
- 'etc/kayobe/environments/ci-aio/**'
18+
- 'etc/kayobe/inventory/**'
19+
- 'etc/kayobe/kolla/**'
20+
- 'kayobe-env'
21+
- 'requirements.txt'
22+
- 'terraform/aio/**'

.github/workflows/stackhpc-all-in-one.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ on:
4343
description: Name of cloud in clouds.yaml
4444
type: string
4545
required: true
46+
if:
47+
description: Whether to run the workflow (workaround for required status checks issue)
48+
type: boolean
49+
default: true
4650
secrets:
4751
KAYOBE_VAULT_PASSWORD:
4852
required: true
@@ -57,6 +61,7 @@ jobs:
5761
# NOTE: Runner needs unzip and nodejs packages.
5862
all-in-one:
5963
name: All in one
64+
if: inputs.if
6065
runs-on: [self-hosted, stackhpc-kayobe-config-aio]
6166
permissions: {}
6267
env:

.github/workflows/stackhpc-build-kayobe-image.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
no_proxy:
1717
type: string
1818
required: false
19+
if:
20+
description: Whether to run the workflow (workaround for required status checks issue)
21+
type: boolean
22+
default: true
1923
outputs:
2024
kayobe_image:
2125
description: Reference of Kayobe image that was built
@@ -28,6 +32,7 @@ env:
2832
jobs:
2933
build-kayobe-image:
3034
name: Build kayobe image
35+
if: inputs.if
3136
runs-on: ubuntu-20.04
3237
permissions:
3338
contents: read

.github/workflows/stackhpc-pull-request.yml

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,29 @@ name: Pull request
88
'on':
99
pull_request:
1010
jobs:
11+
# Detect which files have changed and use this to run jobs conditionally.
12+
# Note that we can't use the workflow-level paths attribute since this
13+
# would skip the workflow entirely, and would prevent us from making the
14+
# aio jobs required to pass (a skip counts as a pass).
15+
check-changes:
16+
runs-on: ubuntu-20.04
17+
permissions:
18+
pull-requests: read
19+
name: Check changed files
20+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
21+
outputs:
22+
aio: ${{ steps.changes.outputs.aio }}
23+
steps:
24+
- name: GitHub Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: Check changed files
28+
uses: dorny/paths-filter@v2
29+
id: changes
30+
with:
31+
# Filters are defined in this file.
32+
filters: .github/path-filters.yml
33+
1134
tox:
1235
runs-on: ubuntu-20.04
1336
permissions: {}
@@ -34,38 +57,55 @@ jobs:
3457
- name: Run Tox ${{ matrix.environment }} 🧪
3558
run: tox -e ${{ matrix.environment }}
3659

60+
# A skipped job is treated as success when used as a required status check.
61+
# The registered required status checks refer to the name of the job in the
62+
# called reusable workflow rather than the jobs in this file. The following
63+
# jobs need to run unconditionally to allow GitHub required status checks to
64+
# pass even when there are changed files. The `! failure()` condition runs
65+
# when the parent jobs completed successfully or were skipped. We pass an
66+
# 'if' argument to the called workflow to allow running it conditionally.
67+
3768
build-kayobe-image:
3869
name: Build Kayobe Image
70+
needs:
71+
- check-changes
3972
uses: ./.github/workflows/stackhpc-build-kayobe-image.yml
73+
with:
74+
if: ${{ needs.check-changes.outputs.aio == 'true' }}
4075
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
4176

4277
all-in-one-centos-ovs:
4378
name: aio (CentOS OVS)
4479
needs:
80+
- check-changes
4581
- build-kayobe-image
4682
uses: ./.github/workflows/stackhpc-all-in-one.yml
4783
with:
4884
kayobe_image: ${{ needs.build-kayobe-image.outputs.kayobe_image }}
4985
neutron_plugin: ovs
5086
OS_CLOUD: sms-lab-release
87+
if: ${{ needs.check-changes.outputs.aio == 'true' }}
5188
secrets: inherit
52-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
89+
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
5390

5491
all-in-one-centos-ovn:
5592
name: aio (CentOS OVN)
5693
needs:
94+
- check-changes
5795
- build-kayobe-image
5896
uses: ./.github/workflows/stackhpc-all-in-one.yml
5997
with:
6098
kayobe_image: ${{ needs.build-kayobe-image.outputs.kayobe_image }}
6199
neutron_plugin: ovn
62100
OS_CLOUD: sms-lab-release
101+
if: ${{ needs.check-changes.outputs.aio == 'true' }}
63102
secrets: inherit
64-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
103+
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
65104

66105
all-in-one-rocky-ovs:
67106
name: aio (Rocky OVS)
68107
needs:
108+
- check-changes
69109
- build-kayobe-image
70110
uses: ./.github/workflows/stackhpc-all-in-one.yml
71111
with:
@@ -77,12 +117,14 @@ jobs:
77117
vm_image: Rocky8-2022-11-08
78118
vm_interface: ens3
79119
OS_CLOUD: sms-lab-release
120+
if: ${{ needs.check-changes.outputs.aio == 'true' }}
80121
secrets: inherit
81-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
122+
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
82123

83124
all-in-one-rocky-ovn:
84125
name: aio (Rocky OVN)
85126
needs:
127+
- check-changes
86128
- build-kayobe-image
87129
uses: ./.github/workflows/stackhpc-all-in-one.yml
88130
with:
@@ -94,12 +136,14 @@ jobs:
94136
vm_image: Rocky8-2022-11-08
95137
vm_interface: ens3
96138
OS_CLOUD: sms-lab-release
139+
if: ${{ needs.check-changes.outputs.aio == 'true' }}
97140
secrets: inherit
98-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
141+
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}
99142

100143
all-in-one-ubuntu-ovs:
101144
name: aio (Ubuntu OVS)
102145
needs:
146+
- check-changes
103147
- build-kayobe-image
104148
uses: ./.github/workflows/stackhpc-all-in-one.yml
105149
with:
@@ -108,12 +152,13 @@ jobs:
108152
neutron_plugin: ovs
109153
vm_image: Ubuntu-20.04
110154
OS_CLOUD: sms-lab-release
155+
if: ${{ needs.check-changes.outputs.aio == 'true' }}
111156
secrets: inherit
112-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
113157

114158
all-in-one-ubuntu-ovn:
115159
name: aio (Ubuntu OVN)
116160
needs:
161+
- check-changes
117162
- build-kayobe-image
118163
uses: ./.github/workflows/stackhpc-all-in-one.yml
119164
with:
@@ -122,5 +167,6 @@ jobs:
122167
neutron_plugin: ovn
123168
vm_image: Ubuntu-20.04
124169
OS_CLOUD: sms-lab-release
170+
if: ${{ needs.check-changes.outputs.aio == 'true' }}
125171
secrets: inherit
126-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
172+
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}

0 commit comments

Comments
 (0)