Job concurrency group ignored for build matrix

Hi, I’m trying to limit job concurrency as per this documentation: Workflow syntax for GitHub Actions - GitHub Docs

I’ve added concurrency: my_group to the job (which runs twice due to different configurations in a build matrix). However, this seems to be ignored, and the two jobs run in parallel. I would like them to run sequentially.

Is the jobs.<job_id>.concurrency not yet supported for build matrices?

1 Like

The site won’t let me edit or delete this question, but I found a solution: the max-parallel attribute for build matrices can prevent jobs from running in parallel. Interestingly, when I removed the build matrix and manually created the two jobs, the concurrency attribute still didn’t prevent them from running in parallel.

I’ve encountered this same issue, but I wouldn’t consider that max-parallel is really a solution.

I’ve both tried multiple explicit jobs in the same workflow and using a matrix, in which I use concurrency. I have the concurrency group labeled such that it reflects a portion of the matrix jobs. I have 3 jobs in the matrix which target an environment, and I have another 3 jobs in the matrix which target a different environment. The two environments can completely work in parallel, but the jobs for a specific environment cannot. And now I need to add a third environment.

Using max-parallel with 1 wastes a lot of time in my case, whereas if concurrency limited only 1 job in the group from running, it would work perfectly.

The only other workaround I can really think of is if I don’t use a matrix for all the environments, but split each environment into it’s own matrix so I can control that each environment only has 1 job running at a time, but jobs in separate environments can run in parallel. The unfortunate aspect of this approach is that it requires a decent amount of duplicate job configuration and steps.