Skip to content

Commit

Permalink
workflow optimization (#844)
Browse files Browse the repository at this point in the history
related to #840

skipping already finished workflows, NOT concurrent (different PR)

I've been doing investigations about canceling workflows (https://github.com/fkirc/skip-duplicate-actions).
The action works by checking in pre_job whether the pipe has already been run. Then in the main job there is a condition
that either continues processing or skips the job.

This results in ALWAYS running all workflows, even duplicate ones. The difference is that the duplicates will
terminate at a different point. We will still see a lot of green runs.

It's a bit different than I imagined (not starting or CANCEL the duplicate at all).
I found out that I can cancel the workflow programmatically via HTTP POST. So if we
create different custom ction, we can cancel on top and probably delete cancelled job.

Signed-off-by: kuritka <[email protected]>
  • Loading branch information
kuritka authored Jan 28, 2022
1 parent b2bfb3d commit 8937f86
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,23 @@ on:
- '**.drawio'
- '.spelling'
jobs:
skip-check:
runs-on: ubuntu-latest
name: Skip the job?
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
skip_after_successful_duplicate: 'true'
do_not_skip: '["workflow_dispatch", "schedule"]'

go-inspect:
name: Inspect packages
runs-on: ubuntu-20.04
needs: skip-check
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v2
# see: https://golangci-lint.run/usage/configuration/#config-file
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/terratest-more-clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,22 @@ on:
- '.spelling'

jobs:
skip-check:
runs-on: ubuntu-latest
name: Skip the job?
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
skip_after_successful_duplicate: 'true'
do_not_skip: '["workflow_dispatch", "schedule"]'

terratest-n-clusters:
runs-on: ubuntu-20.04
needs: skip-check
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v2
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/terratest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,22 @@ on:
- '.spelling'

jobs:
skip-check:
runs-on: ubuntu-latest
name: Skip the job?
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
skip_after_successful_duplicate: 'true'
do_not_skip: '["workflow_dispatch", "schedule"]'

terratest:
runs-on: ubuntu-20.04
needs: skip-check
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v2
with:
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/upgrade-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,22 @@ on:
- '.spelling'

jobs:
skip-check:
runs-on: ubuntu-latest
name: Skip the job?
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
skip_after_successful_duplicate: 'true'
do_not_skip: '["workflow_dispatch", "schedule"]'

upgrade-testing:
runs-on: ubuntu-20.04
needs: skip-check
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v2
with:
Expand Down

0 comments on commit 8937f86

Please sign in to comment.