How to "close" a concurrency gate

The docs on concurrency gates states that “so when you open a gate, you have to close it.” But the docs don’t say exactly which part of the examples “closes” the gate. When no step “depends_on” the previous one anymore, is the gate closed? Or do you need to explicitly reuse the “concurrency_gate: tag” again to signal this is the last one? What if the pipeline fails before it gets to the close? I assume the gate is then opened again?

Also, somewhat unrelated but is it possible to set dynamic concurrency_gate names? Something like “concurrency_gate: job-lock/$$JOB_ID”?


Hey @cwawrzonek

Thanks for the message.

To close the conconcurrency gate, you reuse the concurrency_gate: tag”. With the same tag name as used while opening it.

If you only provide one and a not a pair “concurrency_gate: tag”, it isn’t consider a gate, it would just a concurrency group followed by some other steps. The steps need to have chain dependencies using the depends_on attribute, to one to ensure the workflow of the concurrency gate.

You can do also use dynamic Concurrency groups as seen below

  - command: 'echo hello world'
    label: 'Dynamic Using Branch'
    branches: 'main'
    concurrency: 1
    concurrency_group: 'gate/$BUILDKITE_BRANCH'