You use the artifact parameters to map artifacts to a script task so that the script task can 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 that the artifact output property is shared. See Add a jFrog Artifactory Task.

Procedure

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

    Use the form: ${StageName.TaskName.ARTIFACT_OUTPUT}

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

    For example, an artifact group variable might be: ${Dev.Artifact.ARTIFACT_OUTPUT}

    An incorrect form, which does not work as an artifact group variable is: ${StageName.TaskName.artifacts}

  5. Click Add to define the Artifact input parameters.

    Option

    Description

    Parameter Name

    Name of the Shell variable that refers to an artifact in the script.

    For example: artifact_config

    Parameter Value

    Artifact name defined in the artifact group.

    For example: CodeStream_JAR

  6. From the drop-down menu, select Download URL or Repository URL.

    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.

    For example: portNumber or buildID

    Parameter Value

    Value for the Shell variable.

    For example: 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 environment variable named VCAC_APP_DOWNLOAD_URL to determine the version of the VCAC artifact to download from the repository. The artifact input parameter to the script must be the parameter named VCAC_APP_DOWNLOAD_URL.

wget -O VCAC_APP_DOWNLOAD_URL
echo "Configuring VCAC application";

To enable the script to share data with the 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