I am creating a workflow in GitHub Actions and I'm having trouble with concurrency & lockable resources.
I have a job that runs unit tests on a specific resource. I have a pool of different resources that can be tested but only one of the resources can be tested at a time.
So I created a workflow call like this and set my concurrency group based on the name of my resource.
on:
workflow_call:
inputs:
array:
type: string
required: true
concurrency:
group: pytest-${{ inputs.array }}
cancel-in-progress: false
jobs:
test:
...
The workflow that calls the workflow above is triggered when a push is made, so the same workflow can be run at once. I want to be able to test a resource that is currently not being tested. So I tried making a second job that would calls the workflow w/ a different resource name if it was cancelled. But I get an error saying I am not allowed to do so since I can't call on a workflow thats queue is full.
on:
workflow_call:
inputs:
array:
type: string
required: true
concurrency:
group: pytest-${{ inputs.array }}
cancel-in-progress: false
jobs:
test:
...
test_diff_array:
needs: [test]
if: {{ cancelled() }}
uses: this/workflow/path@master
with:
array: diff_array_name
So idk what to do. Is there some lockable resource pool like Jenkins? Or sh
PS I dont want to use any public github actions
I tried looking up ways to make lockable resources like in Jenkins. Tried using github concurrency
${{ inputs.array }}
expression will return null when used inconcurrency
block. Since it is returning null, your concurrency rule evaluates the group value aspytest-
and tries to queue them. What you can try instead is to extract the input value by using this expression${{ toJson(github.event.inputs.array) }}
. So your concurrency block should look like this.