zuul/tests/fixtures/layouts/multiple-semaphores.yaml
James E. Blair 153f8a90cc Support multiple semaphores
This allows jobs to request multiple semaphores.  Zuul will wait until
all are available before acquiring them* and will not start a job unless
all have been acquired.

This is useful for jobs which require access to mulitple limited resources
(especially if other jobs require access to a subset or superset of those
same resources).

* Implementation note: for efficiency, we actually do acquire them
  one-by-one but then release any which have been acquired if they are
  not all available.  This all happens very quickly within a single
  attempt to start a job.  We don't hold semaphores while we wait for
  others as that could cause deadlocks.

To be consistent with other job attributes which accept lists, this
deprecates job.semaphore and replaces it with job.semaphores.

Change-Id: I295a891a2d02b904820d8f60afe8ef862693b75d
2021-05-25 17:52:23 -07:00

41 lines
541 B
YAML

- pipeline:
name: check
manager: independent
trigger:
gerrit:
- event: patchset-created
success:
gerrit:
Verified: 1
failure:
gerrit:
Verified: -1
- job:
name: base
parent: null
run: playbooks/base.yaml
- job:
name: job1
semaphores:
- sem1
- job:
name: job2
semaphores:
- sem1
- sem2
- project:
name: org/project1
check:
jobs:
- job1
- project:
name: org/project2
check:
jobs:
- job2