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





Overview

An图像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 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.

Page Contents


YAML Schema

resources: - name:  type: Image configuration: registry:  sourceRepository:  # required if registry is Artifactory region:  # required if registry is on AWS imageName:  imageTag:  autoPull:  #(default true) pin: versionId:  imageTag: 

Tags

name

Analphanumericstring (underscores are permitted) that identifies the resource.

类型

Must be图像for 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 for Docker images in Artifactory when the pipeline is configured to use JFrog CLI v1.

This is not used when the pipeline is configured to use JFrog CLI v2.

如果需要注册在JFrog ArtifactoryJFrog CLI v1
region Required if registry is on AWS
imageName

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

Required
imageTag The version tag of the initial version of the Docker image Required
autoPull

Defaults totrue. The image is automatically pulled to the machine running the step.

Optional
pin

This configuration can be used to pin the resource to a specific version. The pinned resource version will be used by the steps that reference this resource as an input and newer versions will be ignored.

Users have two configuration options when selecting the Image resource version to be pinned:

  • versionId-- Resource version Id (can be obtained through the UI)

  • imageTag--The version tag to be pinned

Steps that use the resource as an output can still produce new versions. New versions will be visible for steps using the resource as an input as long as they are part of the same run of the step that created the version.

When creating a new run,人工成本的m triggercan still be used to override the pinned version to a different one.

Optional

Environment Variables

Whenever图像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__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

resources: - name: Image_1 type: Image configuration: registry: PSSG_DockerRegistry imageName: docker/jfreq_win imageTag: latest 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..."
  • 没有标签
Copyright © 2023 JFrog Ltd.