Skip to content

Commit 978a5b3

Browse files
committed
CI: Skip aio jobs based on changed files
We don't always want to run all aio jobs - it can be wasteful of CI resources and slows down merging changes. This change uses the dorny/paths-filter action to detect changed files and skip jobs as appropriate. Note that we can't use the workflow-level paths attribute since this would skip the workflow entirely, and would prevent us from making the aio jobs required to pass (a skip counts as a pass).
1 parent dae64dd commit 978a5b3

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

.github/path-filters.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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-aio.yml'
12+
- 'etc/kayobe/**'
13+
- '!etc/kayobe/ansible/**'
14+
- 'etc/kayobe/ansible/configure-aio-resources.yml'
15+
- 'etc/kayobe/ansible/growroot.yml'
16+
- 'etc/kayobe/ansible/requirements.yml'
17+
- 'etc/kayobe/ansible/scripts/aio-init.sh'
18+
- '!etc/kayobe/bifrost.yml'
19+
- '!etc/kayobe/bmc.yml'
20+
- '!etc/kayobe/cephadm.yml'
21+
- '!etc/kayobe/containers/**'
22+
- '!etc/kayobe/environments/aufn-ceph/**'
23+
- '!etc/kayobe/environments/ci-builder/**'
24+
- '!etc/kayobe/environments/ci-multinode/**'
25+
- '!etc/kayobe/inspector.yml'
26+
- '!etc/kayobe/ipa.yml'
27+
- '!etc/kayobe/kolla/config/bifrost/bifrost.yml'
28+
- '!etc/kayobe/kolla/kolla-build.conf'
29+
- '!etc/kayobe/overcloud-dib.yml'
30+
- '!etc/kayobe/seed*'
31+
- '!etc/kayobe/stackhpc-overcloud-dib.yml'
32+
- '!etc/kayobe/stackhpc-overcloud-host-images.yml'
33+
- '!etc/kayobe/vault.yml'
34+
- 'kayobe-env'
35+
- 'requirements.txt'
36+
- 'terraform/aio/**'

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ 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: Check changed files
25+
uses: dorny/path-filter@v2
26+
id: changes
27+
with:
28+
# Filters are defined in this file.
29+
filters: .github/path-filters.yml
1130
tox:
1231
runs-on: ubuntu-20.04
1332
permissions: {}
@@ -36,8 +55,12 @@ jobs:
3655

3756
build-kayobe-image:
3857
name: Build Kayobe Image
58+
needs:
59+
- check-changes
3960
uses: ./.github/workflows/stackhpc-build-kayobe-image.yml
40-
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
61+
if:
62+
- github.repository == 'stackhpc/stackhpc-kayobe-config'
63+
- needs.check-changes.outputs.aio == 'true'
4164

4265
all-in-one-centos-ovs:
4366
name: aio (CentOS OVS)

0 commit comments

Comments
 (0)