Using the PAC commands

Use the PAC language to create HCL DevOps Deploy (Deploy) processes.

Before you begin

To get started, install the PAC tools.

  1. On the dashboard, click Help > Tools > Process-as-code Compiler.
  2. Extract the downloaded pacc-version_number file.
  3. Optionally, if you want to reference PAC commands from anywhere on your computer, add the folder to your path system variable.

About this task

To use PAC scripts in your applications, upload valid PAC files to the Deploy server. You initially create processes in the process designer and then download them as PAC files. When you finish editing the PAC script, you upload them to the server. The processes that you define in PAC files are identical to the processes that you define in the process designer.

The PAC tools consist of a number of command files. The primary commands are upload and download. The primary commands are further organized by type: application, component, and generic. For example, the PAC command to upload an application process is: upload-application-process. The PAC command to download a generic process is: download-generic-process. Similarly, you can upload and download a component process using the PAC commands.

Upload examples

The command format for uploading PAC files is provided in the following code example:

upload-<process-type>-process <user-name> <server-url> <process-id> <next-version> input.pac

All PAC scripts have the same arguments and differ only by the type of process referenced. For example, to upload an application-type file named my_command.pac, the command might look like the following code example:

upload-application-process my_user_name https://my_server:4540 17542df8-a0a3-7b7d-ffa9-88ebe19324a9 2 my_command.pac

This command example uploads a new version of the application process defined in the my_command.pac file.

Download examples

The command format for downloading PAC files is provided in the following code example:

download-<process-type>-process <user-name> <server-url> <process-id> <next-version> input.pac

For example, to download an application-type file named my_command.pac, the command might look like the following code example:

download-application-process my_user_name https://my_server:4540 17542df8-a0a3-7b7d-ffa9-88ebe19324a9 3 my_command.pac

This command example downloads the process identified by the version ID to a PAC file named my_command.pac. If the version is not specified, the latest version is downloaded.

Silent upload and download of PAC files

The upload and download commands prompt you to enter your password manually. However, you can upload and download the PAC files silently by adding the following parameters to the commands:

  • --password <your_PAC_password>
    For example, the following command uploads the PAC file silently:
    upload-<process-type>-process <user-name> <server-url> <process-id> <next-version> input.pac --password <your_PAC_password> 
  • --password-variable MY_PAC_PASSWORD, where MY_PAC_PASSWORD is an environment variable that defines your PAC password. You can use this option in automation and scripts to supply the password without exposing it directly in the commands.
    For example, the following command uploads the PAC file without exposing your password in the command:
    upload-<process-type>-process <user-name> <server-url> <process-id> <next-version> input.pac --password-variable MY_PAC_PASSWORD 
Notes:
  • If you use both parameters in a command, the --password parameter is used in preference to the --password-variable parameter.
  • If you use --password-variable but the named environment variable is not set, then the parameter does not work. In this case, the console prompts you to provide the password manually.

To implement PAC processes, complete the following steps:

Procedure

  1. From the dashboard, create a process.
    The process can be of any type, application, component, or generic. You use the ID assigned by the server to the process in your PAC files to identify the process. You do not need to define steps with the process designer.
  2. From the command line, download the PAC file using the download-<process-type>-process PAC command.
  3. In any text editor, edit the PAC file.
  4. Upload the PAC file using the process ID assigned to it by the server.
    Along with the process ID you obtained from the server, you must assign a unique process version number to the uploaded process.

Results

The next time that you open the process designer, the designer displays the new process defined in the PAC file.