Configuring triggers to attach changelists from Helix Core clients to Helix ALM items

You can configure Helix Core triggers to attach changelists to Helix ALM items from Helix Core clients. When users submit changelists from clients, they can include the tag for the Helix ALM item to attach the changelist to in the description. A trigger runs, verifies that the specified item exists, and then attaches the changelist to the item. See Attaching changelists to items from Helix Core clients.

Attached changelists are displayed on the item Source Files tab in Helix ALM. If the Helix Swarm URL is configured for the Helix Core provider in the Helix ALM project, you can click a hyperlink to open the changelist in Swarm. See Viewing source control changelists.

Perform the following steps to configure Helix ALM and triggers to attach changelists to items.

1. Review the requirements for using triggers.

2. Add a Helix Core provider to the Helix ALM project.

3. Download and modify the attachToHelixALM Python script. The script retrieves information from Helix Core and sends it to the Helix ALM source control provider CGI.

4. Add trigger definitions to Helix Core.

Requirements

Make sure the following components are installed to use changelist attachment triggers.

  • Helix ALM 2017.1 or later
  • Helix ALM external source control provider CGI (ttextpro.exe) on the web server that hosts Helix ALM CGIs. See the installation help for information.
  • Helix Core with P4Python. P4Python may require additional DLLs. See the Perforce API help for information.
  • Python 3.5

You must also enable external source control provider access in the Helix ALM Registry Utility to send attachment information from Helix Core to Helix ALM. See the Registry Utility help for information.

Downloading and modifying the trigger Python script

The triggers to attach changelists to Helix ALM items run from a Python script stored on the Helix Core server. After downloading the script, modify it to include information about your Helix Core and Helix ALM configurations.

1. Download the script and save it on the computer that hosts Helix Core.

2. Edit the following configuration variables in the script.

Variable Description Example
EXTERNAL_PROVIDER_URL URL for the Helix ALM source control provider CGI on your web server (e.g., http://localhost/cgi-bin/ttextpro.exe). EXTERNAL_PROVIDER_URL = ‘http://localhost/cgi-bin/ttextpro.exe’
SSL_CERTIFICATE_MODE Indicates how triggers connect to the web server hosting the Helix ALM source control provider CGI. If the web server enforces HTTPS and has a valid certificate, use ssl.CERT_REQUIRED. If the web server has a self-signed certificate, use ssl.CERT_NONE to prevent HTTPS from failing and returning an error that the certificate is not trusted. SSL_CERTIFICATE_MODE = ssl.CERT_REQUIRED
SSL_PROTOCOL_MODE SSL protocol that the web server supports. The default value is ssl.PROTOCOL_SSLv23, which supports SSL, SSL2, SSL3, and TLS. SSL_PROTOCOL_MODE = ssl.PROTOCOL_SSLv23
PROVIDER_KEY Key from the Helix Core provider configured in the Helix ALM project. Copy the key from the Source Control Providers dialog box and paste it in the script. PROVIDER_KEY = ‘{123456-abc-789-efghijk}:{abcdef-123-ghi-456789}’
P4PORT Port number for Helix Core. Must be a string. P4PORT = ‘1666’
P4USER Helix Core user to log in when the trigger connects to the server. P4USER = ‘Administrator’
P4PASSWD Password for the Helix Core user used to log in to the server. P4PASSWD = ‘p@ssword’
ISSUE_TAG
TEST_CASE_TAG
REQUIREMENT_TAG
Helix ALM item abbreviations that identify which items to attach changelists to. You can use the default tags or specify different tags if item types are renamed in the project. Default tags: IS for issues, TC for test cases, and RQ for requirements. If you do not know the abbreviations to use, you can find them in the Rename Field Labels dialog box. ISSUE_TAG = ‘IS’TEST_CASE_TAG = ‘TC’ REQUIREMENT_TAG = ‘RQ’

3. Save the script.

Adding trigger definitions

You need to add definitions for the trigger to run from the p4 triggers command.

1. At a command prompt on the computer that hosts Helix Core, enter p4 triggers.

A temporary file that contains trigger information opens.

2. Add the following lines to the file.

Keep the following in mind:

  • The change-submit and change-commit lines support Helix Core and Edge configurations.
  • Replace <DepotName> with the depot name to configure the trigger for.
  • Replace <PythonPath> with the location of the attachToHelixALM.py script.
  • Whitespace is required at beginning of each command.
  • %changelist% is replaced with the changelist number when the trigger runs.

     check-ALM-item-exists-on-change change-submit //<DepotName>/... "<PythonExePath>\attachToHelixALM.py %changelist% verify"

     attach-to-ALM-item-on-change change-commit //<DepotName>/... "<PythonExePath>\attachToHelixALM.py %changelist%"

     check-ALM-Item-exists-on-push push-submit //<DepotName>/... "<PythonExePath>\attachToHelixALM.py %changelist% verify"

     attach-to-ALM-item-on-push push-commit //<DepotName>/... "<PythonPath>\attachToHelixALM.py %changelist%"

3. Save the file.

The trigger definitions are copied to Helix Core.

Example

     check-ALM-item-exists-on-change change-submit //streamsDepot/... "C:\python35\python C:\ALMTrigger\attachToHelixALM.py %changelist% verify"

     attach-to-ALM-item-on-change change-commit //streamsDepot/... "C:\python35\python C:\ALMTrigger\attachToHelixALM.py %changelist%"

     check-ALM-Item-exists-on-push push-submit //streamsDepot/... "C:\python35\python C:\ALMTrigger\attachToHelixALM.py

     attach-to-ALM-item-on-push push-commit //streamsDepot/... "C:\python35\python C:\ALMTrigger\attachToHelixALM.py %changelist%"