How To

How to use the IBM UrbanCode Release plug-in part 1: Add Comment to Task step

Print

The IBM UrbanCode Release plug-in for IBM UrbanCode Deploy provides tools that integrate the two products more efficiently. Once installed, you can use the four plug-in steps in your IBM UrbanCode Deploy  process design workflows:

Step 1: Add Comment to Task
Add comments in IBM UrbanCode Deploy to  automated tasks started by IBM UrbanCode Release scheduled deployments.

Step 2: Update Application
Update the IBM UrbanCode Release inventory for applications deployed by IBM UrbanCode Deploy.

Step 3: Add Snapshot Status

  • Add a version statuses to snapshots during deployment processes.
  • Add comments and attachments to statuses.

Step 4: Get Release for Environment
Get the name of a release that is active for a specific environment, to facilitate auto progression for releases.

This article covers the Add Comment to Task step.  The other steps are covered in the following articles:

Part 2: Update Application step

Part 3: Add Snapshot Status

Plugin prerequisites:
Download the IBM UrbanCode Release plug-in from the IBM UrbanCode Deploy Plugin page, and then import the ucr_plugin-version.zip file (Home > Settings > Plugins  > Load Plugin).

Optional:
Define  authentication properties required by the plug-in as system properties. System properties are accessible from anywhere, and, when changed, are automatically updated across all process steps that use them.


release-plugin-properties

Step: Add Comment to Task

This step enables users to add comments to automated tasks started by IBM UrbanCode Release to deployment processes in IBM UrbanCode Deploy.

This step displays the output of IBM UrbanCode Deploy deployment processes directly in IBM UrbanCode Release task rows.  On an IBM UrbanCode Release scheduled deployment page, you can access IBM UrbanCode Deploy task execution logs by  clicking the “View Process Request” link associated with the task.  The link redirects you to the IBM UrbanCode Deploy Process Request logs where  you can update task comments in real time.

Step prerequisites
This step requires the task ID of the IBM UrbanCode Release task.
When IBM UrbanCode Release starts an automated task, an application process request that contains task-related properties is sent to IBM UrbanCode Deploy. The task ID is contained in a property called: post-deploy-message.  You can see the property on the Properties tab for the application process request.


release-plugin-prerequisite

This property contains the required taskId.  The post-deploy-message property is accessible in the application process request scope but is not directly accessible by a component process.
A simple way to pass the property to the component process is to create a component process property that the application  can use  to pass the value of the post-deploy-message property.

To pass the property:

1) In IBM UrbanCode Deploy, create a component process property called: taskPostMessage (or something similar) with no default value. This figure shows the property added to the affected component.


release-plugin-property

2) In the application process, use the taskPostMessage property to pass the value of post-deploy-message by referencing it like this:  ${p:post-deploy-message}. This figure shows the property in the IBM UrbanCode Deploy application process.


release-plugin-add-comment-task-form
The component process can now retrieve the value of post-deploy-message.

 

Example: using the Add Comment to Task step
In this example, comments are added to an IBM UrbanCode Release automated task in a scheduled deployment.  The comments are generated from the output logs of two steps in an IBM UrbanCode Deploy component process.   The following figure shows the requesting automated task in IBM UrbanCode Release.


release-plugin-add-comment-task-sd

This figure shows the workflow of the corresponding component process  in IBM UrbanCode Deploy.  The output logs of the ExportBackupLogs and SendNotification steps are examined and passed to the steps following them in the workflow,  Add Comment with backup logs URL, and Add Email Notification Comment, which are highlighted in the illustration.


release-plugin-add-comment-task-workflow

The  ExportBackupLogs step uses an external tool to archive backup logs during processing to a web server. An automatically-generated URL is included in the step’s output. By using a post processing script, you can scan the step’s output and retrieve the URL and save it to a property that can be passed to the following step. The following step, Add Comment with backup logs URL, uses the output property to create a comment in IBM UrbanCode Release.

Post processing script example
This example demonstrates how to scan the output of a step and save it to an output property that is accessible by the following step, such as Add Comment To Task.  Every automation plug-in step has a post-processing element. By using a post-processing script, you can save a step’s output to an output property.

In this example, the script is called exportOutputLogs.


release-plugin-add-comment-task-post

A post-processing script is a JavaScript script (post-processing scripts must use JavaScript) that automatically executes when a step completes processing. In this instance, the script scans the output logs of the step. The following figure shows the script.


release-plugin-add-comment-task-example-post

In this case, the backup log tool has an output message that follows this pattern:

Output: http://xxxx/xxx.html.

This contains the URL where the logs for the backup process can be accessed.

This snippet retrieves the row and saves it to an output property named outputlogs:

scanner.register("Output:", function(lineNumber, line) {
var value = line.replace("Output:", "");
properties.put("outputlogs", value);
});
scanner.scan();

The outputlogs property can be referenced by the next step:

${p:NameOfTheStep/outputlogs}

 

Configuring the Add Comment to Task step

This figure show the configuration for an Add Comment to Task step.  Using the properties created earlier, the step retrieves the output log of the previous step and sends it to IBM UrbanCode Release.


release-plugin-add-comment-task-step

Add Comment to Task fields:

URL contains the location of IBM UrbanCode Release server.
User and Password provide user credentials for authentication.
Comment contains the message that is sent to IBM UrbanCode Release.  In this case, it appends the value returned by the outputlogs property to user-entered text.
Post Message identifies the IBM UrbanCode Release automated task that receives the comment. The ${p:taskPostMessage} property reference returns the task ID of the automated task.

Result
During the execution of the IBM UrbanCode Deploy deployment process, the comments are created and added to the task row in IBM UrbanCode Release.
By expanding the row, the comments are displayed, as shown in the following figure:


release-plugin-add-comment-task-result