Add comment to process (like approve process)

Document ID : KB000010601
Last Modified Date : 14/02/2018
Show Technical Document Details
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.

Background:

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.

Instructions:

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.

I have created 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: 

image001.jpg
 
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.

image002.jpg
 
(Program field = C:\Users\Administrator\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.

image003.jpg

image004.jpg

(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.

image005.jpg

Additional Information:

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

“Define a User-Defined Process”: https://docops.ca.com/ca-harvest-scm/13-0/en/administrating/define-lifecycle-processes#DefineLifecycleProcesses-DefineaUser-DefinedProcess

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” https://docops.ca.com/ca-harvest-scm/13-0/en/administrating/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" https://docops.ca.com/ca-harvest-scm/13-0/en/administrating/use-the-system-variables#UsetheSystemVariables-PasswordSystemVariable

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

“hpp Command – Promote Package” https://docops.ca.com/ca-harvest-scm/13-0/en/command-reference/get-started-with-ca-harvest-scm-commands/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”.