Share this page

# Script

Use the Script bundled plugin to specify an operating system command or the path to a script, for example, a Windows batch file or Linux shell script.

Tip: If you use PulseUno as part of Dimensions CM, store your script files in Dimensions CM. Paths must be relative to the stream root.

In this topic:

## Configure the Script plugin

When you add the Script plugin to a chain, specify the plugin configuration details.

To configure the Script step:

1. Add the Script step to a chain, as described in Create chains.

2. Enter the plugin configuration details:

   Field | Description
   --- | ---
   Title | Enter a name for the plugin step or accept the default name.
   Language of script | Select a script language: Windows Batch Windows PowerShell Shell Script
   Location | Select the script location: Inline command. To specify your script as an inline command, enter the script in the Command Line box. File in workspace. To point to a script file, enter the path to a script file in the File Path field, for example, scripts/runstep.bat.
   Support legacy ${var} variable replacement | The syntax for referencing variables is {{variable-name}}. By default, PulseUno also recognizes the legacy ${variable-name} syntax. (Optional) Clear this option if you want PulseUno to recognize and substitute only the {{variable-name}} variables.
   Use custom shell | To use a custom shell, select this option and specify the shell location, for example: {{cygwin-path}}/bin/bash This option overrides the use of the default system shell specified in the Language of Script option. Windows Subsystem for Linux (WSL) version limitations: To use WSL 1, you need Windows 10 version 1803 or later. For WSL 2, you need Windows 10 version 1909 or later.
   Use custom exit codes to indicate unstable or failed script | (Optional) Set your own exit codes that indicate if a completed build is unstable or failed. Enter a list of exit codes separated by commas. By default, if the script exits with an exit code of 0, it is a Success. If the script exits with a non-zero exit code, it is a Failure.
   Use custom log level mapping | (Optional) To refine the logs and include or exclude particular entries, specify a regular expression for the relevant log threshold level: Trace, Debug, Info, Warning, Error. Your custom entries override the default patterns. Typically, the script output log is set to the Info level, which includes general information, warnings, and errors.
   Control options | (Optional) Define the control options for the plugin step: Enable step. By default, the step is enabled to run. Clear this option if you need to deactivate the step. Deactivated steps are skipped when the chain runs. Ignore unit test counts in reviews, pull requests and changesets. Select this option to exclude the results of post-processing unit tests from the chain run results. If your chain has several steps of the same type, this option helps prevent the same unit test counts from being reported multiple times. Fail the step. Specify the conditions for failing the step, such as unit test failures, findings criteria, and/or console log entries. Mark step as unstable. Specify the conditions for making the step unstable, such as unit test failures, findings criteria, and/or console log entries. Post processing. Deactivate all or some post-processing steps that run automatically after the step completes. By default, all post-processing steps are enabled to run.
   Output variables | (Optional) Specify the output variables to be passed to other steps down the chain. For details, see Publish output variables.

Back to top

## Environment variables

This section provides a list of default environment variables you can use in scripts.

To reference environment variables in script steps, use the following syntax:

Operating system | Syntax
--- | ---
Windows | %ENVVAR_NAME%
Linux | $ENVVAR_NAME or ${ENVVAR_NAME}

The following environment variables are supported:

Variable | Description
--- | ---
PULSE_CHAINNUM PULSE_CHAIN_NUM | The chain run build number.
PULSE_CHANGESET_ID | The alphanumeric changeset identifier (stream version) or commit hash.
PULSE_DIRECTORY | The location of the workspace directory containing the source code (also set as the working directory of the script).
PULSE_FETCH_CHANGESET | The alphanumeric identifier of the changeset checked out in the Fetch Sources step. Has the same value as PULSE_CHANGESET_ID.
PULSE_FETCH_STREAM_NAME | The name of the stream or branch checked out in the Fetch Sources step. Dimensions CM products: PulseUno displays the value in the following format: PRODUCT:STREAM_NAME
PULSE_LOGINNAME | The user who made the delivery.
PULSE_MESSAGE | The commit message for the delivery.
PULSE_PRODUCT | The name of the product or Git repository in which the script runs.
PULSE_PRODUCT_URL | The URL of the product or Git repository in which the script runs.
PULSE_REPORT_FILE | A file in the temp directory to which the plugin may write its results. After the script runs, the file link is included on the chain run page.
PULSE_SCMCONNECTIONURI | A unique identifier for the Git or Dimensions CM database.
PULSE_SPACE | The name of the space in which the script runs.
PULSE_STREAM_NAME | The name of the stream or branch associated with the changeset.
PULSE_STREAMTITLE | The name of the project or stream.
PULSE_STREAM_VERSION | Dimensions CM products: The stream version that was delivered. PulseUno displays the value in the following format: PRODUCT:STREAM_NAME;VERSION Git repositories: Has the same value as PULSE_CHANGESET_ID.
PULSE_STREAMVERSIONID | An identifier for the stream version in Dimensions CM.
PULSE_VAULT_USERNAME PULSE_VAULT_PASSWORD | Temporary system credentials that represent a one-time username and password to use for deploying artifacts to a vault. Temporary system credentials are valid only for the duration of the chain run. PulseUno generates the username and password values automatically when a chain is triggered, and invalidates them as soon as the chain finishes.

Note: Built-in variables in the pulse. scope can be converted to environment variables by replacing the pulse. scope with PULSE_. For example, the built-in variable pulse.agent_name has the same value as the environment variable PULSE_AGENT_NAME. For a list of built-in variables, see Built-in variables.

Variables specified in the environment.properties file are also available to the script as environment variables.

Back to top

See also:

- Use plugins
- Set chain options
- View chain runs

https://admhelp.microfocus.com PulseUno 8942
Tips to improve your search results... PulseUno Help Center PulseUno Help 24.2 - 25.2 All View Local Help Center View Online Help Center Version: