Skip to content

Commit

Permalink
ci: run versioned k8s jobs only on selected branches
Browse files Browse the repository at this point in the history
By using a matrix strategy with excluding certain branches and
Kubernetes versions, the number of CI jobs per PullRequest should stay
limited.

Closes: #4060
Signed-off-by: Niels de Vos <[email protected]>
  • Loading branch information
nixpanic authored and mergify[bot] committed Aug 21, 2023
1 parent 1098751 commit a57fe08
Showing 1 changed file with 52 additions and 80 deletions.
132 changes: 52 additions & 80 deletions .github/workflows/pull-request-commentor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,111 +8,70 @@ on:
- "release-v*"
types:
- labeled
jobs:
add-comment:
if: >
(github.event.label.name == 'ok-to-test' &&
github.event.pull_request.merged != true)
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add comment to trigger external storage tests for Kubernetes 1.25
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/k8s-e2e-external-storage/1.25

- name: Add comment to trigger external storage tests for Kubernetes 1.26
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/k8s-e2e-external-storage/1.26
- name: Add comment to trigger external storage tests for Kubernetes 1.27
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/k8s-e2e-external-storage/1.27
permissions:
pull-requests: write

- name: Add comment to trigger external storage tests for Kubernetes 1.28
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/k8s-e2e-external-storage/1.28
jobs:
branch-k8s-selection:
runs-on: ubuntu-latest

- name: Add comment to trigger helm E2E tests for Kubernetes 1.25
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/mini-e2e-helm/k8s-1.25
strategy:
matrix:
branch: [release-v3.8, release-v3.9, devel]
k8s: ["1.25", "1.26", "1.27", "1.28"]
exclude:
# the next Ceph-CSI version will not be tested with old Kubernetes
- k8s: "1.25"
branch: devel
# Ceph-CSI <= 3.9 was released before Kubernetes 1.28
- k8s: "1.28"
branch: release-v3.8
- k8s: "1.28"
branch: release-v3.9

- name: Add comment to trigger helm E2E tests for Kubernetes 1.26
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/mini-e2e-helm/k8s-1.26
- name: Add comment to trigger helm E2E tests for Kubernetes 1.27
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/mini-e2e-helm/k8s-1.27
if: >
(github.event.label.name == 'ok-to-test' &&
github.event.pull_request.merged != true &&
github.base_ref == matrix.branch)
- name: Add comment to trigger helm E2E tests for Kubernetes 1.28
steps:
- name: >
Add comment to trigger external storage tests for Kubernetes
${{ matrix.k8s }}
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/mini-e2e-helm/k8s-1.28
/test ci/centos/k8s-e2e-external-storage/${{ matrix.k8s }}
- name: Add comment to trigger E2E tests for Kubernetes 1.25
- name: >
Add comment to trigger helm E2E tests for Kubernetes
${{ matrix.k8s }}
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/mini-e2e/k8s-1.25
/test ci/centos/mini-e2e-helm/k8s-${{ matrix.k8s }}
- name: Add comment to trigger E2E tests for Kubernetes 1.26
- name: Add comment to trigger E2E tests for Kubernetes ${{ matrix.k8s }}
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/mini-e2e/k8s-1.26
/test ci/centos/mini-e2e/k8s-${{ matrix.k8s }}
- name: Add comment to trigger E2E tests for Kubernetes 1.27
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/mini-e2e/k8s-1.27
any-branch-k8s-version:
runs-on: ubuntu-latest

- name: Add comment to trigger E2E tests for Kubernetes 1.28
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CEPH_CSI_BOT_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
/test ci/centos/mini-e2e/k8s-1.28
if: >
(github.event.label.name == 'ok-to-test' &&
github.event.pull_request.merged != true)
steps:
- name: Add comment to trigger cephfs upgrade tests
uses: peter-evans/create-or-update-comment@v3
with:
Expand All @@ -129,6 +88,19 @@ jobs:
body: |
/test ci/centos/upgrade-tests-rbd
remove-label:
runs-on: ubuntu-latest

# run after the other jobs
needs:
- branch-k8s-selection
- any-branch-k8s-version

if: >
(github.event.label.name == 'ok-to-test' &&
github.event.pull_request.merged != true)
steps:
- name: remove ok-to-test-label after commenting
uses: actions/github-script@v6
with:
Expand Down

0 comments on commit a57fe08

Please sign in to comment.