Enforce that a Global Process can only be called by another process

Enforce that a Global Process can only be called by another process

ISSUE:

Micro Focus Deployment Automation allows you to create Global Processes that exist outside of Applications and Components. These processes can be used to create reusable processes that can be used across multiple applications - for example applying snapshot and version statuses. In such a scenario you do not want the Global Processes to be called directly as this will circumvent your process, instead you would want to enforce that they can only be callable from a "parent" process.

HOW TO STEPS:

If a Global Process is executed from a parent process then the property "parent.property.context.id" will be set. We can use this fact to determine whether to continue or stop the process. One way to do this in the Global Process is to add a Switch step as the first step which checks whether this property is set. In order to continue with the process we can use a regular expression to check if the property has a value. The value if it does will be a UUID, something like "b48672b7-a4d8-460b-b666-8b4a3c95c86d" so we can use the regular expression: "/[a-z0-9]+$/". The other branch can have the "Default" option selected and should fail the process. One way to achieve this is to add a "Run Groovy Script" step with content:

println "This process may not be run directly. It must be called by another process."
System.exit(1)

An example of the process is illustrated below:

only-run-from-parent.png
You can achieve the same result without a Switch step by putting a precondition on the "Stop Process" step as follows:

!properties.get(parent.property.context.id)

However this will result in a "Precondition failed" in the Log which I think could confuse some users.

Labels (2)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
5 of 5
Last update:
‎2020-01-27 18:27
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.