Skip to main content
Version: Deploy 25.1

Lock plugin

The Lock plugin is a Deploy plugin that adds capabilities for preventing simultaneous deployments.

Features

  • Lock a specific environment / application combination for exclusive use by one deployment
  • Lock a complete environment for exclusive use by one deployment
  • Lock specific containers for exclusive use by one deployment
  • List and clear locks using a lock manager CI
  • Wait for lock

Usage

Locking deployments

When a deployment is configured, the Lock plugin examines the CIs involved in the deployment to determine whether any of them must be locked for exclusive use. If so,it contributes a step to the beginning of the deployment plan to acquire the required locks. If the necessary locks can't be obtained, the deployment will enter a PAUSE state and can be continued at a later time. If the enviroment to which the deployment is taking place has its enableLockRetry property set, then the step will wait for a period of time before retrying to acquire the lock.

If lock acquisition is successful, the deployment will continue to execute. During a deployment, the locks are retained, even if the deployment fails and requires manual intervention. When the deployment finishes (either successfully or is aborted), the locks will be released.

Configuration

The locks plugin adds synthetic properties to specific CIs in Deploy that are used to control locking behavior. The following CIs can be locked:

  • udm.Application: this ensures that only one version of an application can deploy to a given environment at a time. When set at the application level, the lock applies to all deployment packages (versions) under that application. Deployments of the same application to different environments are not affected and can run in parallel.
  • udm.DeployedApplication: this ensures that only one deployment of a particular application to an environment can be in progress at once
  • udm.Environment: this ensures that only one deployment to a particular environment can be in progress at once
  • udm.Container: this ensures that only one deployment can use the specific container at once

Each of the above CIs has the following synthetic property added:

  • allowConcurrentDeployments (default: true): indicates whether concurrent deployments are allowed. If false, the Lock plugin will lock the CI prior to a deployment.
important

The scope of the lock depends on the CI where this setting is applied. On udm.Application, it controls locking for that application within an environment. On udm.Environment or udm.Container, it can also block deployments of different applications that target the same environment or container.

note

When allowConcurrentDeployments is set to false at the application level (udm.Application), all versions under that application are affected. If multiple versions are triggered for deployment to the same environment while the lock is held, the waiting versions are queued and will proceed automatically once the active deployment completes. The execution order of queued deployments is not guaranteed (not FIFO), as they are processed asynchronously.

For a detailed walkthrough with examples, see Native Locking and Concurrency Management for Deployment Tasks.

The udm.Environment has the following additional synthetic properties :

  • lockAllContainersInEnvironment (default: false): If set, will lock all containers in environment instead of only the environment
  • enableLockRetry (default: false): If set, will not PAUSE the deployment on failure to acquire locks. Instead continually tries to obtain the lock after a period of time.
  • lockRetryInterval (default: 30): Seconds to wait before retrying to obtain lock.
  • lockRetryAttempts (default: 60): Number of retry attempts. On failure to obtain locks after the designated attempts, the deployment will be PAUSED.

The udm.Container has the following additional synthetic property:

  • limitNumberOfConcurrentDeployments: If set, limits the number of concurrent deployments on the container.

Implementation

Each lock is stored as a file in a directory under the Digital.ai Deploy installation directory. The lock.Manager CI can be created in the Infrastructure section of Deploy to list and clear all of the current locks.