Skip to content

Commit

Permalink
Add cancel-in-progress
Browse files Browse the repository at this point in the history
Intention is to cancel ongoing/queued jobs if a new version of a PR is uploaded

Fixes #626
  • Loading branch information
erikbosch committed Sep 7, 2023
1 parent fed6a1d commit d27e8ed
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/check_license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
jobs:
check-spdx-headers:
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:

- name: Checkout code
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/check_push_rights.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ on:
description: "In possession of ghcr.io tokens?"
value: ${{ jobs.check_push_rights.outputs.have_secrets }}


jobs:
check_push_rights:
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

outputs:
have_secrets: ${{ steps.check-secrets.outputs.have_secrets }}

Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/kuksa-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@ jobs:
uses: ./.github/workflows/check_push_rights.yml
secrets: inherit

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

build-docker:
runs-on: self-hosted
needs: checkrights

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -103,6 +111,11 @@ jobs:

kuksa-client-test:
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- name: Checkout kuksa.val
uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/kuksa-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:

kuksa-go-client-test:
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- name: Checkout kuksa.val
uses: actions/checkout@v3
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/kuksa_databroker-cli_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ on:
workflow_call:
workflow_dispatch:


jobs:
lint:
name: Lint
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- name: Installing JVM
run: sudo apt update && sudo apt-get install -y default-jre
Expand Down Expand Up @@ -60,12 +63,20 @@ jobs:
uses: ./.github/workflows/check_push_rights.yml
secrets: inherit

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

# Run on selfhosted, because our runner has native ARM build in a remote
# builder (no need for qemu)
build-container:
runs-on: [ self-hosted ]
needs: checkrights

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
with:
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/kuksa_databroker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ on:
workflow_call:
workflow_dispatch:


jobs:
lint:
name: Lint
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- name: Installing JVM
run: sudo apt update && sudo apt-get install -y default-jre
Expand All @@ -58,6 +61,10 @@ jobs:
name: Test
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -93,12 +100,20 @@ jobs:
uses: ./.github/workflows/check_push_rights.yml
secrets: inherit

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

# Run on selfhosted, because our runner has native ARM build in a remote
# builder (no need for qemu)
build-container:
runs-on: [ self-hosted ]
needs: checkrights

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -196,6 +211,10 @@ jobs:
runs-on: ubuntu-latest
needs: [build-container]

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:

- uses: actions/checkout@v3
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/kuksa_val_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ jobs:
uses: ./.github/workflows/check_push_rights.yml
secrets: inherit

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

build:
runs-on: [ self-hosted ]
needs: checkrights

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/kuksa_val_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
buildAndTest:
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
with:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on: [pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
with:
Expand Down

0 comments on commit d27e8ed

Please sign in to comment.