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





Versions Compared

Key

  • 这条线是补充道。
  • 这条线是移除。
  • Formatting was changed.

Overview

Excerpt

AnImageresource 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 aDocker Registry Integrationthat 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.

Panel
title Page Contents

Table of Contents
maxLevel 2
minLevel 2


YAML Schema

Code Block
language yml
resources: - name:  type: Image configuration: registry:  sourceRepository:  # required if registry is Artifactory region:  # required if registry is on AWS imageName:  imageTag:  autoPull:  #(default false)

Tags

name

Analphanumericstring (underscores are permitted) that identifies the resource.

type

Must beImagefor this resource type.

configuration

Specifies all configuration selections for the resource.

Tag

Description

Required/Optional
registry The name of aDocker Registry Integration Required
sourceRepository The name of the repository in Artifactory to which the images will be published Required if registry is in JFrog Artifactory
region

An

Newtablink
Text AWS region identifier
URL https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html

Required if registry is on AWS
imageName

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

Note

Once anImageresource is created, theimageNameattribute cannot be changed, since Pipelines maintains a history of versions for that image name.

Ifthe image nametheimageNameneeds to be changed:

  1. Either:
    • Delete the existingImageresource
    。Either:
    • Createand createa newImageresource with a newimage name.imageName。Since this option requires you to change the name of theImageresource, 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 andcreateupdatethesameexistingImageresource with a newimage name.
    Update the pipeline YAML to reference the newImageresource.
    • imageName。这个选项允许您使用相同的Imageresource and does not require you to update any of the steps. However, the steps using thisImageresource will be marked as inconsistent and not allowed to run for the whole hour.
  2. Sync the pipeline source, if required.
Required
imageTag The version tag of the initial version of the Docker image Required
autoPull

Whentrue, the image is automatically pulled to the machine running the step.

Defaults to

Optional

Environment Variables

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

Environment Variable

Description

res__name
Name of the resource
res__sourceRepository
The name of the repository in Artifactory
res__region The AWS region identifier
res__imageName The file path of the Docker image
res__imageTag The version tag of the initial version of the Docker image
res__autoPull Value of the autopull flag

Examples

The Pipelines DSL for this example is available inthis repositoryin theJFrogGitHub account.

Example 1

Code Block
language yml
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

Code Block
language yml
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..."
Copyright © 2023 JFrog Ltd.