Locking and queuing

This section explains how Code Pipes handles multiple users making changes to the Terraform state simultaneously within a project, focusing on locking and queuing mechanisms.

Approx Reading Time: 2 minutes

Code Pipes Locking and Queuing Features

Scenario: Multiple Users and Environment A

Let's consider a scenario where there are two users working within Project 1, and Environment A has already been deployed. Both users attempt to make changes to Environment A and deploy it again. What would happen in this case?

Locking and Queuing Mechanisms

Code Pipes incorporates locking and queuing features to handle concurrent changes to the Terraform state within a project. The behavior in the given scenario can be summarized as follows:

  1. If the first user's environment deploy job is in progress, Code Pipes will wait until it completes before starting the second user's deploy job. This ensures that changes are validated and applied in a sequential manner.

  2. In the event that the first job is waiting for admin approval (in the PENDING state), the second job will be blocked. Code Pipes will only proceed with validating and applying the second user's changes after the first user's changes have been approved.

  3. If the first job fails, the second job will start without any dependencies on the first job. This allows the second user's changes to proceed independently.

By implementing these locking and queuing mechanisms, Code Pipes ensures that changes to the Terraform state are executed in an orderly manner, preventing conflicts and maintaining the integrity of the deployment process.

Note: For more detailed information on the job approval flow, please refer to the approval-flow.