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.

Configuration

When you add the Script plugin step to a chain, specify the following configuration details:

Field Description
Title Enter a name for this plugin step.
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 aborted 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) Expand Control options and define the following settings:

  • Enable step. Leave this option selected to enable the step to run. Clearing this option deactivates the step.

  • 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 findings criteria and/or log entries.

  • Mark step as unstable. Specify the conditions for making the step unstable, such as findings criteria and/or log entries.

  • Post processing. Disable 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) Enter the variables to be passed to other steps down the chain. For details, see Publish output variables to chain steps.

Back to top

Environment variables

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

Windows %ENVVAR_NAME%
Linux $ENVVAR_NAME or ${ENVVAR_NAME}

You can include the following environment variables in scripts.

Variable Description
PULSE_CHANGESET_ID The alphanumeric changeset identifier (stream version) or commit hash.
PULSE_SUITE_NAME The space in which the chain runs.
PULSE_PRODUCT_NAME The product or Git repository in which the chain runs.
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_STREAM_NAME The name of the stream or branch associated with the changeset.
PULSE_CHAINNUM The build number.
PULSE_FETCH_STREAM The name of the stream or branch checked out in the Fetch Sources step.
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_STREAMTITLE The name of the project or stream.
PULSE_STREAMVERSIONID An identifier for the stream version in Dimensions CM.
PULSE_SCMCONNECTIONURI A unique identifier for the Git or Dimensions CM database.
PULSE_LOGINNAME The user who made the delivery.
PULSE_MESSAGE The commit message for the delivery.
PULSE_DIRECTORY The location of the workspace containing the source code (also set as the working directory of the script).

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: Legacy environment variables that don't start with PULSE_, for example, CURRENT_DIR, are deprecated.

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

Back to top

See also: