1

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?

ventsyv
  • 3,316
  • 3
  • 27
  • 49
  • 2
    Are there any concurrency directives in the reusable workflow files? – Benjamin W. Jul 11 '23 at 18:54
  • @BenjaminW. Yes, just noticed those. I"ll update the question. – ventsyv Jul 11 '23 at 19:22
  • Do all three have `-1` in `group`? – Benjamin W. Jul 11 '23 at 21:39
  • @BenjaminW Yes, they are all in the same group for some reason. Nobody seems to be able to come up with a reason why it was done this way - I suspect it was basically copy/paste error. Changing the group name fixed the issue. If you put it as a answer, I'll accept it. – ventsyv Jul 12 '23 at 17:46

1 Answers1

1

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.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116