This PR adds the functionality to check a given lock in a pool and block/wait until that lock becomes unclaimed.
The rational behind it is as follows:
Given that we have multiple disparate pipelines that may trigger in any order:
we would like a build pipeline to be able to claim the lock for the duration of a number of tasks (e.g Docker build/push) and release the lock afterwards
the second (or multiple) deploy pipeline should wait until the build pipeline is completed before proceeding to pull in the updated output (ie. the Docker image built in build pipeline)
The intent is to have the deploy pipelines always use the latest available output (Docker image), and if there is an active build taking place to produce said output (Docker image), then we want to wait/block until that output is ready/published.
Now we could simply use acquire across all the pipelines, but this feel clunky since we'd end up dealing with deploy pipelines acquiring the locks unnecessarily, when all we want to do is check for existence of a claimed lock by the build pipeline only. This is especially true in cases of many:1 dependency in pipelines - we want to avoid hundreds of pipelines trying to acquire a lock unnecessarily.
check details in docs:
check: If set, we will check for an existing claimed lock in the pool and wait until it becomes unclaimed.
If there is an existing lock in claimed state: wait until lock is unclaimed
If there is an existing lock in unclaimed state: no-op
If no lock exists: fail
The purpose is to simply block until a given lock in a pool is moved from a
claimed state to an unclaimed state. This functionality allows us to build
dependencies between disparate pipelines without the need to acquire locks.
Note: the lock must be present to perform a check. In other words, a get
step to fetch metadata about the lock is necessary before a put step can
check the existence of the lock.
This PR adds the functionality to
check
a given lock in a pool and block/wait until that lock becomes unclaimed. The rational behind it is as follows:Given that we have multiple disparate pipelines that may trigger in any order:
build
pipeline to be able to claim the lock for the duration of a number of tasks (e.g Docker build/push) and release the lock afterwardsdeploy
pipeline should wait until thebuild
pipeline is completed before proceeding to pull in the updated output (ie. the Docker image built inbuild
pipeline)The intent is to have the
deploy
pipelines always use the latest available output (Docker image), and if there is an active build taking place to produce said output (Docker image), then we want to wait/block until that output is ready/published.Now we could simply use
acquire
across all the pipelines, but this feel clunky since we'd end up dealing withdeploy
pipelines acquiring the locks unnecessarily, when all we want to do is check for existence of a claimed lock by thebuild
pipeline only. This is especially true in cases of many:1 dependency in pipelines - we want to avoid hundreds of pipelines trying toacquire
a lock unnecessarily.check details in docs:
check
: If set, we will check for an existing claimed lock in the pool and wait until it becomes unclaimed.The purpose is to simply block until a given lock in a pool is moved from a claimed state to an unclaimed state. This functionality allows us to build dependencies between disparate pipelines without the need to
acquire
locks.Note: the lock must be present to perform a check. In other words, a
get
step to fetch metadata about the lock is necessary before aput
step can check the existence of the lock.Thanks in advance for the review!
cc @xtremerui