I have the following workflow:
name: Test Job
on:
workflow_dispatch:
schedule:
- cron: "30 2 * * *"
jobs:
job1:
uses: ./.github/workflows/job1.yml
with:
var: true
secrets: inherit
job2:
uses: ./.github/workflows/job2.yml
secrets: inherit
job3:
uses: ./.github/workflows/job3.yml
with:
var2: false
secrets: inherit
job4:
uses: ./.github/workflows/job4.yml
with:
var3: latest
secrets: inherit
If I run this via a worflow_dispact, 2 of the jobs will be executed (in parallel) and the other two would be skipped.
It appears to be random which ones run and which ones are skipped. For example, one run, 1&4 ran, 2&3 were skipped. Next run 1, 2, and 4 ran, 3 was skipped.
The ones that run pass. I ran 1 & 2 together (3 & 4 commented out), then 3 & 4 together ( 1 & 2 commented out) and both of those runs were successful.
I thought the other 2 might be timing out, but they actually get skipped within of minute of kicking off the run.
EDIT: Just noticed that jobs 1,2, and 3 all have the following:
concurrency:
group: ci-tests-${{ github.ref }}-1
cancel-in-progress: true
Any ideas what might be causing this?
The concurrency controls you amended in your edit are responsible; they all use the same value for group
, resulting in jobs 1, 2, and 3 cancelling each other, with only the most recent job "surviving".
To fix, make sure group
has a value unique to the jobs that are supposed to cancel each other, e.g., by replacing -1
with -2
and -3
in the corresponding reusable workflows.