Access Resource Properties

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

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
jfrog.local:5000/alpine37

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
baseball
$ printenv res_myImage_equipment
bat
$ printenv res_myImage_field
diamond

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