Cloud customer?
Start for Free >
Upgrade in MyJFrog >
What's New in Cloud >

Search





Overview

An Image resource is used to add a reference to a Docker image to your pipeline.


An Image resource holds information of a docker image that is stored through a Docker Registry Integration that may in one of the following registry sources:

  • JFrog Artifactory / JFrog Container Registry
  • Amazon Container Registry
  • Google Container Registry
  • Azure Container Registry
  • Docker Hub

An Image resource can be used as both input and output. Step like DockerBuild will generate it as an output and steps like DockerPublish will use it as input to publish to a Docker registry.

Page Contents


YAML Schema

resources:
  - name: 		<string>
     type: 		Image
     configuration:
       registry:        	<docker integration name>
       sourceRepository: 	<name of the artifactory repo>   # required if registry is Artifactory
       region:              <string>                         # required if registry is on AWS
       imageName:	    	<imageRepo/imageName>
       imageTag: 			<string>
       autoPull: 			<boolean> #(default false)

Tags

name 

An alphanumeric string (underscores are permitted) that identifies the resource.

type 

Must be Image for this resource type.

configuration

Specifies all configuration selections for the resource.

Tag

Description

Required/Optional
registry The name of a Docker Registry IntegrationRequired
sourceRepository The name of the repository in Artifactory to which the images will be publishedRequired if registry is in JFrog Artifactory
regionRequired if registry is on AWS
imageName

The file path of the Docker image, of the form imageRepo/imageName

Once an Image resource is created, the imageName attribute cannot be changed, since Pipelines maintains a history of versions for that image name.

If the imageName needs to be changed:

  1. Either:
    • Delete the existing Image resource and create a new Image resource with a new imageName. Since this option requires you to change the name of the Image resource, you will need to update all the relevant steps to use the new input resource. 
      or
    • Wait for an hour from the time of deletion and update the existing Image resource with a new imageName. This option enables you to use the same Image resource and does not require you to update any of the steps. However, the steps using this Image resource will be marked as inconsistent and not allowed to run for the whole hour.
  2. Sync the pipeline source, if required.
Required
imageTagThe version tag of the initial version of the Docker imageRequired
autoPull 

When true, the image is automatically pulled to the machine running the step.

Defaults to false.

Optional

Environment Variables

Whenever Image is used in a step, a set of environment variables is automatically made available that you can use in your step.

Environment Variable

Description

res_<resource_name>_name
Name of the resource
res_<resource_name>_sourceRepository
The name of the repository in Artifactory
res_<resource_name>_regionThe AWS region identifier
res_<resource_name>_imageNameThe file path of the Docker image
res_<resource_name>_imageTagThe version tag of the initial version of the Docker image
res_<resource_name>_autoPull Value of the autopull flag

Examples

The Pipelines DSL for this example is available in this repository in the JFrog GitHub account.

Example 1

resources:  
  - name: Image_1
    type: Image	
    configuration:	   
      registry: PSSG_DockerRegistry	      
      imageName: docker/jfreq_win	      
      imageTag: latest	
      autoPull: true

pipelines:
  - name: pipelines_Image_1
    steps:
      - name: step_Image_1
        type: PowerShell
        configuration:
          nodePool: win_2019
          inputResources:
            - name: Image_1
        execution:
          onExecute:
            - write-output "executing step..."
            - if($Image_1_isTrigger -ne "true"){
              Write-Error "Stop" -ErrorAction Stop
              }

Example 2

resources:
  - name: Image_2
    type: Image
    configuration:
      registry: s_artifactory
      sourceRepository: docker-local
      imageName: ubuntu
      imageTag: latest

pipelines:
  - name: pipelines_IMAGE_2
    steps:
      - name: step_IMAGE_2
        type: PowerShell
        configuration:
          nodePool: win_2019
          inputResources:
            - name: Image_2
        execution:
          onExecute:
            - write-output "executing step..."
  • No labels
Copyright © 2021 JFrog Ltd.