Use this action to report artifact-related data to an environment from a CloudBees Unify workflow run, for artifact traceability purposes.
|
Important
|
This action version (v2.0) is the most recent release of the action.
Previous releases are deprecated.
Version 2.0 replaces multiple required inputs with a single parameter, |
Before using this action, you must first register the artifact you plan to deploy to an environment. This registration saves the artifact information to the CloudBees Unify.
Do one of the following to save your artifact information to the CloudBees Unify:
-
Use the Register a build artifact action in your workflow in a step prior to using this action.
-
Add a publishing step to your workflow prior to using this action. For example, use one of the following actions:
-
Manually create an artifact version in the UI.
| Input name | Data type | Required? | Description |
|---|---|---|---|
|
String |
Yes |
The unique identifier of an artifact. |
|
String |
Required if no job-level |
The environment where the deployment is located.
The |
|
String |
No |
A comma-separated list of artifact labels. NOTE: A maximum of 20 labels are allowed per artifact version, with a maximum of 20 characters per label. |
The following is a basic example of using the action:
jobs:
register_artifact_version_to_my_env:
environment: my_env
steps:
- name: Register deployed artifact
uses: cloudbees-io/register-deployed-artifact@v2
with:
artifact-id: 1234abcd-56ef-ab78-9012-cdef78903456The following example specifies artifact labels:
jobs:
register_artifact_version_to_qa_env:
environment: qa_env
steps:
- name: Register deployed artifact with labels
uses: cloudbees-io/register-deployed-artifact@v2
with:
artifact-id: 1234abcd-56ef-ab78-9012-cdef78903456
labels: label1,label2This example publishes an image with Kaniko, and then reports the data to the CloudBees Unify.
apiVersion: automation.cloudbees.io/v1alpha1
kind: workflow
name: Deployment workflow
on:
workflow_dispatch:
jobs:
build:
outputs:
artifact-id: ${{ fromJSON(steps.push-image.outputs.artifact-ids)[ format('index.docker.io/{0}/my-sample-go-app:{1}', vars.DOCKER_USERNAME, cloudbees.version) ] }}
steps:
- uses: docker://alpine/git:latest
run: |
git config --global --add safe.directory /cloudbees/workspace
- name: checkout
uses: cloudbees-io/checkout@v1
- name: Build Go app
uses: docker://golang:1.20
kind: build
run: |
go build -v ./...
- name: Set up Docker Hub registry
uses: cloudbees-io/configure-oci-credentials@v1
kind: deploy
with:
registry: index.docker.io
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push image to OCI registry
id: push-image
uses: cloudbees-io/kaniko@v1
with:
destination: index.docker.io/${{ vars.DOCKER_USERNAME }}/my-sample-go-app:${{cloudbees.version}}
deploy:
needs: build
steps:
- name: Register deployed artifact
uses: cloudbees-io/register-deployed-artifact@v2
with:
artifact-id: ${{ needs.build.outputs.artifact-id }}
target-environment: devThis code is made available under the MIT license.
-
Learn more about using actions in CloudBees workflows.
-
Learn about the CloudBees Unify.