Closed ashanbrown closed 8 months ago
I need this same feature. @eddiewebb Would you accept a PR for this?
I would also like to have this feature.
Would be up for doing the change
@chabou @DReigada
I would happily review pr with this feature. Please include tests that validate.
Can we discuss about the right way to activate/configure this feature?
I was thinking to add an optional parameter like consider-workflow-name
(false by default to be backward compatible).
@chabou I was thinking something similar to that.
But I was wondering how the parameter block-workflow
would behave if a new parameter like that is introduced.
Some thoughts (when consider-workflow-name
is true):
block-workflow
is false it would look for other workflows with the same name as the current one (instead of using the job name)block-workflow
is true, I don't know what the behaviour should be.It seems that ideally this would be a single parameter with 3 possible values: "block by job name", "block by workflow name", "block by anything".
@eddiewebb Any thoughts how this should be implemented?
I was thinking:
block-workflow
is true :
consider-workflow-name
is true, consider only workflow with same name, or all workflows otherwiseblock-workflow
is false :
consider-workflow-name
This is not ideal but has a better backward compatibility than introducing a multiple values parameter. I don't know what is the best
Maybe it could be useful to consider "only in a workflow with the same name" even for job names filtering (ie. block-workflow is false). It would be simple to explain.
It may be a breaking change and major version rev, but rather than overlapping parameters we move to a single regex which can be empty, everything ('*'), or specific name.
I think that's how we ended up with job name filtering.
Use of old parameter could by-pass new logic for a ring and serve deprecation notice, or could just fail build and explain new model.
Appreciate the dialog on this.
On Fri, Aug 19, 2022, 11:01 AM CHaBou @.***> wrote:
Maybe it could be useful to consider "only in a workflow with the same name" even for job names filtering (ie. block-workflow is false). It would be simple to explain.
— Reply to this email directly, view it on GitHub https://github.com/eddiewebb/circleci-queue/issues/76#issuecomment-1220781551, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIEWSVN5PZSTLC2A66A5ITVZ6OS5ANCNFSM5PVRKZIQ . You are receiving this because you were mentioned.Message ID: @.***>
Yes you're right, regex is the most powerful solution.
Deprecatation warning and automatically transforming block-workflow: true
into *
value for the new parameter seems perfect.
workflow-regex
is a perfect name I guess.
Do we agree that this new parameter is used in addition of other filtering parameter like only-on-branch
or job-regex
?
block-workflow
is a parameter but a job too. Should we deprecate this job too and keep only queue/until_front_of_line
command with some documentation to explain how to have a first job with this command to block an entire workflow?
If it used in combination with job-regex
, should it be considered like an AND or an OR condition?
I think that is a AND: the job will be queued only if there is a job with a name matching job-regex
AND in a workflow with a name matching workflow-regex
. But in this case, without a job-regex
parameter, should workflow-regex
disable the default behavior of matching the job name (to behave like the deprecated block-workflow
)?
I think more and condition. I don't like the idea of dropping the job.
Empty workflow means don't block workflow level, and consider job logic. An asterisk means all workflows will block, but should consider job logic. Similar for named or pattern.
Easiest maybe to enumerate use cases and how to configure.
1) regardless of job make all workflows serialize 2) regardless of activity(job) serialize this specific workflow 3) regardless of workflow, serialize this job. 4) on a specific branch, serialize this job
... Branch logic should be completely independent and the primary decision.
On Sat, Aug 20, 2022, 4:35 AM CHaBou @.***> wrote:
If it used in combination with job-regex, should it be considered like an AND or an OR condition? I think that is a AND: the job will be queued only if there is a job with a name matching job-regex AND in a workflow with a name matching workflow-regex. But in this case, without a job-regex parameter, should workflow-regex disable the default behavior of matching the job name (to behave like the deprecated block-workflow)?
— Reply to this email directly, view it on GitHub https://github.com/eddiewebb/circleci-queue/issues/76#issuecomment-1221259116, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIEWSVV7XXEDJ7OPLMT5VLV2CKEHANCNFSM5PVRKZIQ . You are receiving this because you were mentioned.Message ID: @.***>
I would suggest these configurations:
The job block-workflow
would be an alias of case 1:
job-regex: empty
workflow-regex: .*
Just chiming in here to offer that we are looking for a feature in our organization to serialize a specific job when it's called in a specific workflow, but not serialize it across all workflows.
We currently have the queue/until_front_of_line
enabled for our job that must be serialized but it queues it across all workflows and we only really want to queue it so it can only run one instance of the job within each workflow at a time.
Because we have a large number of workflows, we are getting some very long queues without the ability to do this. I love this orb, and would 100% support a feature to restrict the serialization to within the a workflow, vs. across all. What our ideal state would be is across (5) workflows, only (1) of the job-to-serialize
could be running in each workflow at each time, so that it would allow (5) job-to-serialize
to run at once, as long as each one was running in a separate workflow.
@valernyx I think your usage is the case 5. Will it feet your needs to specify job's name and workflow's name in each workflow (five time in your exemple)?
@chabou Yes, I believe case 5 would support our needs. It sounds like I would be able to specify the job-to-serialize
in each workflow and specify the workflow name to serialize it in as well, so as long as it would allow the job to run (1) time in each workflow (while supporting concurrency across workflows), then this sounds perfect 👍
Is your feature request related to a problem? Please describe. I'd like to serialize a workflow of a specific name without other workflows preventing it from running. Currently we wait for all workflows to complete before starting a workflow.
Describe the solution you'd like Can we check only for existing workflows by workflow name (similar to what we do for serializing jobs)?
Describe alternatives you've considered None
Additional context