It is awesome CircleCI natively implemented queue for jobs. One of the main feature of the eddiewebb/queue orb was ability to skip some jobs conditionally, so if one instance of the job is running, other instances will be skipped completely. Unfortunately, this option is missing in a new feature provided by CircleCI.
Use case is next: we have different workflows (let's name them 1, 2, 3, 4) to build and deploy different part of our application. At the end of each workflow end-to-end tests will be triggered (technically it's implemented as a call to run another workflow with tests, let's name it T). When some of workflows running simultaneously, they will call tests several times in a short period of time. Obviously that in this case we only need single test execution, not all of them.
My suggestion is to add a 'add-to-queue' parameter to a 'serial-group' key. The behavior of that parameter and possible values are provided below.
I tried to cover useful cases on the attached screenshot, in the description of the "add-to-queue" parameter. This block describes the logic of the parameter I want to be implemented.
  • add-to-queue:
  • type: enum
  • enum: ["all", "none", "latest"]
  • default: all
  • description: "Parameter that defines if new instances of the job should be added to the queue
  • all - when job (1) is running, and job (2) and (3) and (4) triggered
  • - in this case all new instances of the job (2) and (3) and (4) will be added to the queue
  • none - when job (1) is running, and job (2) and (3) and (4) triggered
  • - in this case no new instances of the job will be added to the queue, all jobs (2) and (3) and (4) will be cancelled
  • latest - when job (1) is running, and job (2) and (3) and (4) triggered
  • - in this case only the latest instance (4) will be added to the queue,
  • and all other instances between (1) and (4) will be cancelled.
  • In case job (1) is still running and instance (5) triggered,
  • it will be added to the queue and instance (4) will be cancelled"