CloudBees action: Upload a file to JFrog Artifactory

2 minute read

Use this action to upload a file to 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

artifactory-path

String

Yes

The JFrog Artifactory destination path for the upload.

file-path

String

Yes

The path of the file to be uploaded.

url

String

Yes

The JFrog Artifactory server URL.

password

String

Required only if token is not specified.

The JFrog Artifactory password.

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.

artifact-name

String

No

The name of the artifact to send to the CloudBees platform. Defaults to the filename if not provided.

artifact-version

String

No

The version of the artifact to send to the CloudBees platform. Defaults to - if not provided.

send-artifact-info

Boolean

No

If true, sends artifact information to the CloudBees platform for artifact traceability purposes. Default value is false.

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 is a basic example of using the action:

- name: Upload file to JFrog Artifactory uses: cloudbees-io/jfrog-artifactory-upload-file@v1 with: artifactory-path: my-image.tar file-path: /local-path url: ${{ JFROG_URL }} token: ${{ secrets.JFROG_TOKEN }}

Using optional inputs

The following example specifies optional inputs to report artifact data to the workflow run.

- name: Upload file to JFrog Artifactory uses: cloudbees-io/jfrog-artifactory-upload-file@v1 with: artifactory-path: test-image.tar file-path: /local-path url: ${{ JFROG_URL }} username: ${{ secrets.JFROG_USERNAME }} password: ${{ secrets.JFROG_PASSWORD }} artifact-name: my-artifact artifact-version: 1.0.0 send-artifact-info: true

Full workflow example

The following workflow example:

  • Checks out source code from a repository.

  • Uses the action to upload a file to JFrog Artifactory.

  • Prints the artifact ID of the uploaded file.

name: jfrog-artifactory-upload-file kind: workflow apiVersion: automation.cloudbees.io/v1alpha1 on: push: branches: - main jobs: upload-file-job: steps: - name: checkout-source-code uses: cloudbees-io/checkout@v1 - name: Jfrog Artifactory upload file id: jfrog-upload uses: cloudbees-io/jfrog-artifactory-upload-file@v1 with: artifactory-path: my-repo/my-jfrog/test.zip file-path: ${{ cloudbees.workspace }}/my-files/for-upload.zip url: ${{ vars.JFROG_URL }} username: ${{ vars.JFROG_USERNAME }} password: ${{ secrets.JFROG_PASSWORD }} artifact-name: my-artifact artifact-version: 1.0.0 send-artifact-info: true - name: Print output parameter artifact ID from JFrog upload action uses: docker://alpine:latest shell: sh run: | echo "artifact ID for my-artifact:1.0.0 at my-repo/my-jfrog/test.zip is: ${{ steps.jfrog-upload.outputs.artifact-id }}"