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.
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.
Input name | Data type | Required? | Description |
---|---|---|---|
|
String |
Yes |
The Amazon S3 bucket name. |
|
String |
Yes |
The local file path of the object to be uploaded. |
|
String |
Yes |
The Amazon S3 destination path for the upload. |
|
String |
No |
The name of the artifact to send to CloudBees platform.
Default value is |
|
String |
No |
The version of the artifact to send to CloudBees platform.
Default value is |
|
Boolean |
No |
If |
|
String |
No |
The commit ID from the source repository, used when registering the build artifact in CloudBees platform.
Default is |
|
String |
No |
The clone URL of the source repository, used when registering the build artifact in CloudBees platform.
Default is |
|
String |
No |
The ref or branch of the source repository, used when registering the build artifact in CloudBees platform.
Default is |
|
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 |
Output name | Data type | Description |
---|---|---|
|
String |
The unique identifier of the artifact reported to CloudBees platform. |
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
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
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 }}"
This code is made available under the MIT license.
-
Learn more about using actions in CloudBees workflows.
-
Learn about CloudBees platform.