CloudBees action: Promote an image from JFrog Artifactory

2 minute read

Use this action to promote (move or copy) a Docker image from the JFrog Artifactory repository manager. This action also reports artifact-related data to the workflow run for artifact traceability purposes.

All CloudBees action repositories are listed at CloudBees, Inc. on GitHub.

Inputs

Table 1. Input details
Input name Data type Required? Description

source-image-name

String

Yes

The JFrog Artifactory source image name.

source-repository-name

String

Yes

The JFrog Artifactory source repository name.

source-tag

String

Yes

The JFrog Artifactory source tag.

url

String

Yes

The JFrog Artifactory server URL.

token

String

Required only if username and password are not specified.

The JFrog Artifactory token.

username

String

Required only if token is not specified.

The JFrog Artifactory username.

password

String

Required only if token is not specified.

The JFrog Artifactory password.

target-image-name

String

Required only if the target-repository-name and the target-tag are not specified.

The JFrog Artifactory target image name.

target-repository-name

String

Required only if the target-image-name and the target-tag are not specified.

The JFrog Artifactory target repository name.

target-tag

String

Required only if the target-repository-name and the target-image-name are not specified.

The JFrog Artifactory target tag.

copy

String

No

Specifies whether to move or copy the image. Default ('') specifies moving the image, and true specifies copying the image.

Outputs

Table 2. Output details
Output name Data type Description

artifact-id

String

The unique identifier of the artifact reported to the CloudBees platform.

Usage examples

Basic example

The following basic example moves an image to a specified destination:

- name: Promote an image uses: cloudbees-io/jfrog-artifactory-promote-image@v1 with: source-image-name: source-image source-repository-name: local-test source-tag: 1 url: ${{ vars.JFROG_URL }} username: ${{ secrets.JFROG_USERNAME }} password: ${{ secrets.JFROG_PASSWORD }} target-repository-name: test

Copying an image

The following example copies an image to a new destination:

- name: Copy an image uses: cloudbees-io/jfrog-artifactory-promote-image@v1 with: source-image-name: my-source-image source-repository-name: my-repo source-tag: 1 url: ${{ vars.JFROG_URL }} token: ${{ secrets.JFROG_TOKEN }} target-image-name: target-image target-repository-name: my-target-repo target-tag: 12 copy: copy

Full workflow example

The following workflow example:

  • Checks out source code from a repository.

  • Copies a Docker image from a remote JFrog repository to another JFrog repository.

  • Uses the action to move a file.

  • Prints the artifact ID of the uploaded file.

name: jfrog-artifactory-promote-image kind: workflow apiVersion: automation.cloudbees.io/v1alpha1 on: push: branches: - main jobs: promote-image-job: steps: - name: Check out source code uses: cloudbees-io/checkout@v1 - name: JFrog Artifactory promote image id: promote-image uses: cloudbees-io/jfrog-artifactory-promote-image@v1 with: source-image-name: my-docker-image source-repository-name: jfrog-repo-1 source-tag: '1.0.0' url: ${{ vars.JFROG_URL }} username: ${{ vars.JFROG_USERNAME }} password: ${{ secrets.JFROG_PASSWORD }} target-repository-name: jfrog-repo-2 copy: 'true' - name: Print output parameter artifact ID from JFrog pro mote action uses: docker://alpine:latest shell: sh run: | echo "artifact ID for the artifact my-artifact:1.0.0 at my-repo/my-jfrog/test.zip is: ${{ steps.jfrog-upload.outputs.artifact-id }}"