Use Precondition in uDeploy

Most steps in a process can have a precondition. The precondition determines whether the step runs.

Preconditions return Boolean values. If the precondition returns True, the step runs as usual. If the precondition returns anything other than True, the process skips that step.

Suppose we need to create a symlink but only under certain conditions. We create a Shell step:

where the script code to execute will be something like this:

ln -fs ${p:environment/ALPHALib_Path}/${p:version/shlib-alphalibrary} ${p:environment/shlib_path}/ALPHALibrary


environment/ALPHALib_Path = /var/shlib/ALPHALibrary
version/shlib-alphalibrary = v20170713_5_12
environment/shlib_path = /var/cfg/alpha-resources/shlib
ln -fs /var/shlib/ALPHALibrary/v20170713_5_12 /var/cfg/alpha-resources/shlib/ALPHALibrary

We want to execute the shell script only if the property1 exist. Here’s the syntax:

properties.get("environment/property1") !== undefined && 
properties.get("environment/property1") !== null && 
properties.get("environment/property1") !== ""

To access a property we use the properties.get() command. Do not use notation such as ${p:component.myProperty} in the precondition script. For example, to check the value of a component property in a component process, use properties.get(“myProperty”) == “myValue”.


Middleware Analyst specialized on IBM UrbanCode Deploy (uDeploy), WebSphere Application Server (WAS), WebSphere MQ (WMQ), *NIX systems at CSE Consorzio Servizi Bancari - Bologna, Italy

Leave a Reply

Your email address will not be published. Required fields are marked *

five × 2 =