Add comment to process (like approve process)
search cancel

Add comment to process (like approve process)

book

Article ID: 10601

calendar_today

Updated On:

Products

CA Harvest Software Change Manager - OpenMake Meister CA Harvest Software Change Manager

Issue/Introduction

Users need to be able to provide comments when promoting a package to indicate the reason for the promotion and any other necessary details.  Currently, the Promote and Demote processes do not provide this capability.  However it is possible to use UDPs to accomplish this goal.

Environment

Harvest-Software Change Manager v12.5 and up

Resolution

One way this might be accomplished is with a UDP (user defined process).  Invocation of the UDP from Workbench would present a dialog that could be used to provide additional input, which could be written to a separate log file.  Here is a very simple example of how this would work.

You will first need to create a script or application that accepts information as command line parameters and writes that information to a log file.  You can make this script or application as simple or as elaborate as needed to fulfill your logging requirements, and can use whatever language works best for you.  This script will run on the SCM Broker machine (server-side) and should be created to run silently (without run-time input from the user).  All the information needed to run the script or application (including user comments) will come in from parameters on the command line.  As you design this script, make sure that the comment is the last field in the list of parameters.

This is a very simple example Windows batch script that accepts parameters passed in on the command line and appends them to the end of a log file: 

REM Usage: LogMyPromotion.bat "[broker]" "[project]" "[state]" "[package]" comment

set _broker=%1

set _project=%2

set _state=%3

set _package=%4

set _comment=%5

echo %date% %time% %_broker% %_project% %_state% %_package% "_comment% >> C:\Users\Administrator\PromotionLog.txt

 
Next, you will open Administrator Tool, navigate to the project and state for which you want this logging to occur, and create a new “UDP” process.  You will use the Harvest “System” variables to pass into the process the name of your broker, project, state and package, whatever information you need, up to the point of entering the comment.  Make sure the “Allow Additional Input” field is checked.


 
(Program field = C:\Users\<userid>\LogMyPromotion.bat "[broker]" "[project]" "[state]" ["package"])

Notice that the comment parameter is not included on the command line in the Program field.  This is because the comment will be supplied in the “Additional Input” field at runtime.

You will also create a post-linked process for your new UDP process that executes the hpp (Promote Package) command line utility.  Here, as well, you can use the Harvest “System” variables to provide the needed information to execute the process.

(Program field = hpp ["package"] -b "[broker]" -en "[project]" -st "[state]" -usr [user] -pw [password])

To use this new UDP process, in Workbench the user will right click on a package and select the UDP you created to promote the package.  A dialog will pop up providing the “Additional Input” field that your user can use to enter his comments for the log file.  Once he clicks OK the script executes, followed by the “hpp” command.

Additional Information

Information on how to create a User Defined Process (UDP) can be found here:

Define a User Defined Process

In the UDP Process’s Program field you see several parameters with square brackets around them (like “[broker]”). These are the Harvest System Variables and Harvest uses these to pass specific information about the current context to the UDP. You can read more about System Variables here:

Use the System Variables

One thing to be aware of is that a script needs to be run against your Harvest database to enable your Harvest installation to send password information through the “[password]” System Variable.  Read this section very carefully to know how to execute the script: 

The Password System Variable

The “hpp” command line utility we use in the post-link UDP for the actual promotion is described here:

hpp Command – Promote Package

Once this UDP is created, you will be able to copy the process and paste it into other projects and states from the Administrator Tool, thus making it easier to set this up for many different environments. If you right click on the process and select “Copy”, you can navigate to another state and “Paste”.