Skip to content

CI: Skip aio jobs based on changed files #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/path-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file is a list of path filters for the PR workflow in .github/workflows/stackhpc-pull-request.yml.
aio:
- '.automation'
- '.automation.conf/config.sh'
- '.automation.conf/tempest/load-lists/default'
- '.automation.conf/tempest/load-lists/platform.2022.11-test-list.txt'
- '.automation.conf/tempest/load-lists/refstack-2019.11-test-list.txt'
- '.automation.conf/tempest/tempest-ci-aio.overrides.conf'
- '.github/workflows/stackhpc-all-in-one.yml'
- '.github/workflows/stackhpc-build-kayobe-image.yml'
- '.github/workflows/stackhpc-pull-request.yml'
- 'etc/kayobe/*.yml'
- 'etc/kayobe/ansible/configure-aio-resources.yml'
- 'etc/kayobe/ansible/growroot.yml'
- 'etc/kayobe/ansible/requirements.yml'
- 'etc/kayobe/ansible/scripts/aio-init.sh'
- 'etc/kayobe/environments/ci-aio/**'
- 'etc/kayobe/inventory/**'
- 'etc/kayobe/kolla/**'
- 'kayobe-env'
- 'requirements.txt'
- 'terraform/aio/**'
5 changes: 5 additions & 0 deletions .github/workflows/stackhpc-all-in-one.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ on:
description: Name of cloud in clouds.yaml
type: string
required: true
if:
description: Whether to run the workflow (workaround for required status checks issue)
type: boolean
default: true
secrets:
KAYOBE_VAULT_PASSWORD:
required: true
Expand All @@ -57,6 +61,7 @@ jobs:
# NOTE: Runner needs unzip and nodejs packages.
all-in-one:
name: All in one
if: inputs.if
runs-on: [self-hosted, stackhpc-kayobe-config-aio]
permissions: {}
env:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/stackhpc-build-kayobe-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
no_proxy:
type: string
required: false
if:
description: Whether to run the workflow (workaround for required status checks issue)
type: boolean
default: true
outputs:
kayobe_image:
description: Reference of Kayobe image that was built
Expand All @@ -28,6 +32,7 @@ env:
jobs:
build-kayobe-image:
name: Build kayobe image
if: inputs.if
runs-on: ubuntu-20.04
permissions:
contents: read
Expand Down
58 changes: 52 additions & 6 deletions .github/workflows/stackhpc-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@ name: Pull request
'on':
pull_request:
jobs:
# Detect which files have changed and use this to run jobs conditionally.
# 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).
check-changes:
runs-on: ubuntu-20.04
permissions:
pull-requests: read
name: Check changed files
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
outputs:
aio: ${{ steps.changes.outputs.aio }}
steps:
- name: GitHub Checkout
uses: actions/checkout@v3

- name: Check changed files
uses: dorny/paths-filter@v2
id: changes
with:
# Filters are defined in this file.
filters: .github/path-filters.yml

tox:
runs-on: ubuntu-20.04
permissions: {}
Expand All @@ -34,38 +57,55 @@ jobs:
- name: Run Tox ${{ matrix.environment }} 🧪
run: tox -e ${{ matrix.environment }}

# A skipped job is treated as success when used as a required status check.
# The registered required status checks refer to the name of the job in the
# called reusable workflow rather than the jobs in this file. The following
# jobs need to run unconditionally to allow GitHub required status checks to
# pass even when there are changed files. The `! failure()` condition runs
# when the parent jobs completed successfully or were skipped. We pass an
# 'if' argument to the called workflow to allow running it conditionally.

build-kayobe-image:
name: Build Kayobe Image
needs:
- check-changes
uses: ./.github/workflows/stackhpc-build-kayobe-image.yml
with:
if: ${{ needs.check-changes.outputs.aio == 'true' }}
if: github.repository == 'stackhpc/stackhpc-kayobe-config'

all-in-one-centos-ovs:
name: aio (CentOS OVS)
needs:
- check-changes
- build-kayobe-image
uses: ./.github/workflows/stackhpc-all-in-one.yml
with:
kayobe_image: ${{ needs.build-kayobe-image.outputs.kayobe_image }}
neutron_plugin: ovs
OS_CLOUD: sms-lab-release
if: ${{ needs.check-changes.outputs.aio == 'true' }}
secrets: inherit
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}

all-in-one-centos-ovn:
name: aio (CentOS OVN)
needs:
- check-changes
- build-kayobe-image
uses: ./.github/workflows/stackhpc-all-in-one.yml
with:
kayobe_image: ${{ needs.build-kayobe-image.outputs.kayobe_image }}
neutron_plugin: ovn
OS_CLOUD: sms-lab-release
if: ${{ needs.check-changes.outputs.aio == 'true' }}
secrets: inherit
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}

all-in-one-rocky-ovs:
name: aio (Rocky OVS)
needs:
- check-changes
- build-kayobe-image
uses: ./.github/workflows/stackhpc-all-in-one.yml
with:
Expand All @@ -77,12 +117,14 @@ jobs:
vm_image: Rocky8-2022-11-08
vm_interface: ens3
OS_CLOUD: sms-lab-release
if: ${{ needs.check-changes.outputs.aio == 'true' }}
secrets: inherit
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}

all-in-one-rocky-ovn:
name: aio (Rocky OVN)
needs:
- check-changes
- build-kayobe-image
uses: ./.github/workflows/stackhpc-all-in-one.yml
with:
Expand All @@ -94,12 +136,14 @@ jobs:
vm_image: Rocky8-2022-11-08
vm_interface: ens3
OS_CLOUD: sms-lab-release
if: ${{ needs.check-changes.outputs.aio == 'true' }}
secrets: inherit
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}

all-in-one-ubuntu-ovs:
name: aio (Ubuntu OVS)
needs:
- check-changes
- build-kayobe-image
uses: ./.github/workflows/stackhpc-all-in-one.yml
with:
Expand All @@ -108,12 +152,13 @@ jobs:
neutron_plugin: ovs
vm_image: Ubuntu-20.04
OS_CLOUD: sms-lab-release
if: ${{ needs.check-changes.outputs.aio == 'true' }}
secrets: inherit
if: github.repository == 'stackhpc/stackhpc-kayobe-config'

all-in-one-ubuntu-ovn:
name: aio (Ubuntu OVN)
needs:
- check-changes
- build-kayobe-image
uses: ./.github/workflows/stackhpc-all-in-one.yml
with:
Expand All @@ -122,5 +167,6 @@ jobs:
neutron_plugin: ovn
vm_image: Ubuntu-20.04
OS_CLOUD: sms-lab-release
if: ${{ needs.check-changes.outputs.aio == 'true' }}
secrets: inherit
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
if: ${{ ! failure() && github.repository == 'stackhpc/stackhpc-kayobe-config' }}