You can use a custom script task to configure bash or PowerShell scripts and run scripts on any Linux or Windows machine. After the script runs, you can monitor the script progress and capture the script response. You can pass the script response as input to the other release pipeline tasks.

Prerequisites

Procedure

  1. Click the Code Stream tab.
  2. On the Pipelines tab, select an existing pipeline and click Edit to configure it.
  3. Click the Stages > button.
  4. Click Add Task.
  5. Select Script from the Provider drop-down menu.
  6. Enter a name for this custom task and click OK.
  7. Select the new task in the stage.
  8. Confirm to save the pipeline.
  9. Select an Execute Task for the release pipeline.

    Option

    Description

    Always

    Runs the release pipeline task without conditions.

    On Condition(s)

    Runs the release pipeline task only if the defined condition is evaluated as true. If the condition is false, the task is skipped.

    A boolean expression using the following operands and operators is supported.

    • Pipeline variables such as, ${pipeline.variableName}. Curly brackets are reserved for specifying pipeline variables.

    • Task output variables such as, ${Stage1.task1.machines[0].value.hostIp[0]}

    • Default pipeline binding variables such as, ${releasePipelineName}

    • Case insensitive Boolean values such as, true, false, 'true', 'false'

    • Integer or decimal values without quotes

    • String values used with single or double quotes such as, "test", 'test'

    • String and Numeric types of values such as, == Equals and != Not Equals

    • Relational operators such as, > , >=, <, and <=

    • Boolean logic such as, && and ||

    • Arithmetic operators such as, +, -, *, and /

    • Nested expressions using round brackets

    • Strings with literal value ABCD is evaluated as false and the task is skipped.

    Unary operators are not supported.

    A sample condition, ${Stage1.task1.output} == “Passed” || ${pipeline.variableName} == 39

  10. (Optional) : Select the Continue Pipeline execution even if this task fails option.

    This option allows the release pipeline to bypass the failed task and continue with the execution process.

Results

After a custom script task runs, the EXECUTION_ID_FOLDER run folder that contains logFile and exitStatusFile is created in the following paths:

Bash Script

Location

Remote script

<CODESTREAM_FOLDER_PATH>/<ScriptName>

Example: /var/tmp/codestream/demo/f8e27157-792f-428e-8bbd-f88ac106ddd2

Inline script

<CODESTREAM_FOLDER_PATH>/user_defined_script

Example: /var/tmp/codestream/user_defined_script/e05606b8-8acb-43c7-9293-a465e86cc3fe

PowerShell Script

Location

Remote script

<CODESTREAM_FOLDER_PATH>/<ScriptName>

Example: C:\Users\fritz\AppData\Local\Temp\codestream\demo\f8e27157-792f-428e-8bbd-f88ac106ddd2

Inline script

<CODESTREAM_FOLDER_PATH>/user_defined_script

Example: C:\Users\fritz\AppData\Local\Temp\codestream\user_defined_script\e05606b8-8acb-43c7-9293-a465e86cc3fe

Following are the script plug-in system properties, which can be configured on the vRealize Code Stream appliance:

Table 1. Bash Script

Property Name

Description

Default Value

fms.bundle.script.bash.codestream.folder

Configure path for the codestream folder where the script execution folder is created.

/var/tmp/codestream/

fms.bundle.script.bash.log.snippet.lines

Configure number of lines for the log snippet displayed in script response.

50

fms.bundle.script.bash.log.snippet.line.length

Configure the maximum characters per log line after which the log is truncated.

1024

fms.bundle.script.bash.upload.chunk.bytes

For inline script, the data is uploaded in chunks and this property is used to configure chunk size.

1024 * 50

Table 2. PowerShell Script

Property Name

Description

Default Value

fms.bundle.script.powershell.codestream.folder

Configure path for the codestream folder where the script execution folder is created.

C:\Users\<User_Name>\AppData\Local\Temp\codestream\

fms.bundle.script.powershell.log.snippet.lines

Configure number of lines for the log snippet displayed in script response.

50

fms.bundle.script.powershell.log.snippet.line.length

Configure the maximum characters per log line after which the log is truncated.

1024

fms.bundle.script.powershell.upload.chunk.bytes

For inline script, the data is uploaded in chunks and this property is used to configure chunk size.

1024 * 50