Skip to content

cloudbees-io/s3-upload-object

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CloudBees action: Store an object on Amazon S3

Use this action to upload an object file to Amazon Simple Storage Service (Amazon S3). This action also reports artifact-related data to the workflow run for artifact traceability purposes.

Automatic artifact data reporting

This action reports artifact-related data to the workflow run for artifact traceability purposes.

Do not include the register-build-artifact action for the same artifact version, as the resulting run would register duplicate artifact entries to CloudBees platform.

You must specify send-artifact-info: true in order to send artifact data to CloudBees platform.

Inputs

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

bucket-name

String

Yes

The Amazon S3 bucket name.

file-path

String

Yes

The local file path of the object to be uploaded.

s3-path

String

Yes

The Amazon S3 destination path for the upload.

artifact-name

String

No

The name of the artifact to send to CloudBees platform. Default value is false. Defaults to the filename if not provided.

artifact-version

String

No

The version of the artifact to send to CloudBees platform. Default value is false. Defaults to - if not provided.

send-artifact-info

Boolean

No

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

commit

String

No

The commit ID from the source repository, used when registering the build artifact in CloudBees platform. Default is ${{ cloudbees.scm.sha }}.

repository-url

String

No

The clone URL of the source repository, used when registering the build artifact in CloudBees platform. Default is ${{ cloudbees.scm.repositoryUrl }}.

ref

String

No

The ref or branch of the source repository, used when registering the build artifact in CloudBees platform. Default is ${{ cloudbees.scm.ref }}.

component-id

String

No

The ID of the component associated with the artifact. If not provided, the artifact is registered with the component of the current workflow run. Default is ${{ cloudbees.component.id }}.

Outputs

Table 2. Output details
Output name Data type Description

artifact-id

String

The unique identifier of the artifact reported to CloudBees platform.

Usage examples

The following is a basic example of using the action:

      - name: Upload to Amazon S3
        uses: cloudbees-io/s3-upload-object@v1
        with:
          bucket-name: amazon-s3-bucket-name
          file-path: my-local/my-image.tar
          s3-path: my-amazon-s3/s3-image.tar

Using optional inputs

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

      - name: Upload to Amazon ECR
        uses: cloudbees-io/s3-upload-object@v1
        with:
          bucket-name: my-image.tar
          file-path: /local-path
          s3-path: my-path/to-destination
          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 Amazon S3.

  • Prints the artifact ID of the uploaded file.

name: s3-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: S3 upload file
        id: s3-upload
        uses: cloudbees-io/s3-upload-object@v1
        with:
          bucket-name: my-repo/my-bucket/test.zip
          file-path: ${{ cloudbees.workspace }}/my-files/for-upload.zip
          s3-path: ${{ vars.S3_URL }}
          artifact-name: my-artifact
          artifact-version: 1.0.0
          send-artifact-info: true
      - name: Print output parameter artifact ID from S3 upload action
        uses: docker://alpine:latest
        shell: sh
        run: |
          echo "artifact ID for my-artifact:1.0.0 at my-repo/my-bucket/test.zip is: ${{ steps.s3-upload.outputs.artifact-id }}"

License

This code is made available under the MIT license.

References

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 10