Access Resource Properties

JFrog Pipelines Documentation

JFrog Pipelines
Content Type
User Guide

A step that specifies a resource in inputresources can access the properties of that resource through environment variables. The form of the environment variable is:

res_<resource name>_<tag>

For example, you can access the imageName property of an Image resource myImage through an environment variable:

$ printenv res_myImage_imageName

Some resources maintain additional properties that may be accessed as environment variables. These resource types include:

For more information, see Pipelines Resources.

Resource-based State

Additionally, you can add your own properties to a resource that is specified in outputresources using the write_output utility function. This can be used to create stateful pipelines.

The newly attached properties can be accessed as environment variables of the form res_{Resource Name}_{Key Name}. For example, the following creates three properties in the resource myImage.

write_output myImage sport="baseball" equipment="bat" field="diamond"

When the resource is specified in a step's inputsources, these properties can be accessed as the following environment variables:

$ printenv res_myImage_baseball
$ printenv res_myImage_equipment
$ printenv res_myImage_field

For more information on run state, see Creating Stateful Pipelines.