Expected behavior

The function is expected to install an artifact declared in the resource configuration file. It is invoked N times, one for each artifact declared in the resource. Typically, the function has a case statement that performs the appropriate installation steps according to the input parameters:

   function plugin_install_artifact {
    case ${id} in
        'MY_ARTIFACT_ID_1' )
            #fetch the resource installation package from somewhere
            #install in ${installation_path}
            return 0
        'MY_ARTIFACT_ID_2' )
            #fetch the resource installation package from somewhere
            #install in ${installation_path}
            return 0
        *)  echo "Resource artifact id not recognized: "+$id
            return 99
    exit 1

Artifacts are strongly encouraged to depend on the FETCH_URL resource if they need to download some data. This resource exposes a script can be used to download packages from remote location, and to transparently cache the result. Caching prevents multiple nodes in a cluster from trying concurrent downloads against the same remote server. The script is accessible through the ${RESOURCES_FETCH_URL_SCRIPT} environment variable.

Input arguments

The function receives the following arguments:

  • $1: the ID of the artifact to install as specified in the resource configuration.
  • $2: the target installation path.


The function has access to the environment variables that were populated in the PLUGIN_ROOT_LOCATION/artifacts-config/ hook. Typically these variables include every variable that is visible to the plugin script that requested the resource.