Overview
IBM DevOps Deploy is a release automation solution that is used by both large and small corporations all around the globe. The solution is known for its enterprise stability as well as an ability to scale to address a large environment while providing governance and trail of audit that our customers depend on. It is also known for its ability to take a complex deployment process and craft it easily in a way that is simple to understand and maintain.
As an example, one may require the use of semaphores (or locks) in an IBM DevOps Deploy process to avoid two or more deployment requests running at the same time against a target resource that could result in corruption or failure of that application deployment. Further, one may need to ensure a deployment only targets specific resources when executed and having an ability to provide more granular target details are required.
This blog provides a quick start guide to using the locking mechanism in IBM DevOps Deploy while also providing an example of using a resource tag to target certain resources for a given deployment request.
Acquiring a Lock
If you want to prevent concurrent modification of resources with a deployment process, you can leverage the ‘Acquire Lock’ step in an application, component, or a generic process. When you acquire the lock, you will specify a string value. Typically, this will include the name of the application and the name of the target environment at a minimum.
Here is an example of my application process which acquires a lock:

The ‘Acquire Lock’ step prompts you for a ‘Lock Name’ which is a string you specify. In my case, I am using built-in DevOps Deploy properties to specify my application name as well as the target environment as shown below:

When the deployment request is started and the process reaches the ‘Acquire Lock’ step, the process will attempt to obtain a lock with the specified name. If there is not another process using a lock with that name, the current process creates a lock using the name and continues. If another process is using a lock with the specified name, the current process will wait until the lock is available.
All your acquired locks will be visible in the Settings tab by clicking on ‘Locks’ as shown below:

Any acquired locks will appear in this view as shown below:

Releasing the Lock
When your deployment processes are complete, you can release the lock using the ‘Release Lock’ step. This step will release the lock with the specified string value you provide. Here is an example of what that step looks like:

In my example application process, notice that I ensure that the lock is released regardless if the deployment is successful or encounters a failure in the process as shown below:

This way a failed deployment will not accidentally leave a lock around which could cause issues down the line.
NOTE: you can remove locks left in this state by clicking on Settings and then Locks as shown above.
Using Resource Tags to limit deployment to specific targets
Imagine a scenario where you need to deploy an artifact or run an operational process on a specific target. In my example, I am deploying a WAR file and some Property files to two different clusters.
In IBM DevOps Deploy, you can leverage resource tags in the Resource Tree as shown in the example below to help with this targeted deployment scenarios:

In your application process that you configure, you can specify a resource tag for a given step as shown in the example below:

NOTE: Before you can use the Resource Tag in steps like the one shown above, you will need to create the resource tags by clicking on the Settings tab and then clicking on Tags as shown below:

Click on ‘Resource Tags’ in the left pane and press the ‘Create Tag’ button as shown below:

Here is a view of the entire application process once more with emphasis on the use of tags:

Summary
In conclusion, IBM DevOps Deploy has advanced features to handle the most complex deployment scenarios. The use of a Lock (semaphores) ensures that only a single deployment process can run at a time against a specified target resource. Further, you can ensure processes run on the right targets where it is beneficial using Resource Tags. In my example, I had a tag to specify cluster01 and another tag for cluster02.
If you are interested in learning more about DevOps Deploy, you can request a meeting at: https://ibm.biz/DevOpsMeeting
We host DevOps Summits and Bootcamps in cities around the globe, offering deeper insights into the future of software delivery. Join our mailing list to stay informed about upcoming events: https://ibm.biz/DevOpsEventsList