You use the artifact parameters to map artifacts to a script task to enable the script to download artifacts from a repository to the host.

Prerequisites

  • Verify that a script task is available in a release pipeline.

  • Verify that an artifact task is configured and the artifact output property is shared. See Add a VMware Repository Solution Task.

Procedure

  1. Open a release pipeline.
  2. Select the script task from the stage column.
  3. Click the Advanced tab.
  4. Type the artifact group variable.

    ${StageName.TaskName.ARTIFACT_OUTPUT}

    This variable is generated as part of the artifact output from the existing artifact task.

    An example of an artifact group variable, ${Dev.Artifact.ARTIFACT_OUTPUT}.

  5. Click Add to define the Artifact input parameters.

    Option

    Description

    Parameter Name

    Name of the Shell variable referring to an artifact in the script.

    An example parameter name is artifact_config.

    Parameter Value

    Artifact name defined in the artifact group.

    An example parameter value is CodeStream_JAR.

  6. Select Download URL or Repository URL from the drop-down menu.

    The script calls the download URL or the repository URL for an artifact by mapping an artifact input property.

  7. Click Add to define the Other input.

    Option

    Description

    Parameter Name

    Name of the other Shell variable defined in the script.

    An example parameter name is portNumber or buidID.

    Parameter Value

    Value for the Shell variable.

    An example parameter value is 800.

  8. Click Save.

Example Scripts for a Custom Script Task

The following example shows a script that configures a vRealize Automation application.

$ cat configureAppServer.sh
echo "Configure app server";
echo "VCAC Application Download URL: $VCAC_APP_DOWNLOAD_URL";

wget -O $VCAC_APP_DOWNLOAD_URL
echo "Configuring VCAC application";

echo "Starting application on port: $APLICATION_PORT";

MACHINE_IP = ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.)(3)[0-9]*).*/\2/p'
printf "Application URL: $MACHINE_IP:$APPLICATION_PORT/vcac/" > $SCRIPT_RESPONSE_FILE

The script refers to the VCAC_APP_DOWNLOAD_URL environment variable to determine what version of the VCAC artifact to download from the repository. The artifact input parameter to the script should be the VCAC_APP_DOWNLOAD_URL parameter.

wget -O VCAC_APP_DOWNLOAD_URL
echo "Configuring VCAC application";

For the script to be able to share data with other release pipeline tasks, the contents must be written in a response file. The response file contents are stored in the script output variable.

MACHINE_IP = ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'
printf "Application URL: $MACHINE_IP/vcac/" > $SCRIPT_RESPONSE_FILE