Skip to content

cloudbees-io/register-build-artifacts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

CloudBees action: Register build artifacts

Use this action to register multiple artifact versions in CloudBees Unify from a workflow run. The action accepts a JSON array of artifact metadata objects, allowing you to register multiple artifacts in a single step.

💡
When registering just one artifact version, you can use register-build-artifact as an alternative to this action.
Note

Do not include the register-build-artifacts action for the same artifact version with any of the following actions, as the resulting run would register duplicate artifact entries to CloudBees Unify.

Inputs

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

artifact-metadata

String (JSON)

YES

A JSON array of artifact metadata objects. Each object must include:

  • name — artifact name (required)

  • version — version (required)

  • url — artifact URL (required)

  • digest — digest (optional)

  • labels — JSON array of strings (optional)

  • commit — commit ID from the source repository where the artifact was built [1] (optional)

  • repositoryUrl — repository URL [1] (optional)

  • ref — branch or tag reference [1] (optional)

  • componentId — component identifier (optional)

  • type — type of artifact, e.g., docker, helm, maven, etc. This field is for display purposes only. (optional)

[1] Unlike the register-build-artifact action, by default this action does not associate the artifact version with the code commit associated with the workflow run in the workflow’s repository/branch. If you want to associate a commit with this artifact version, specify the commit, repository and branch to use.

Outputs

Table 2. Output details
Output name Data type Description

artifact-ids

JSON string

The output is a JSON object mapping each artifact’s url to its unique artifact ID.

Usage examples

Single artifact example
jobs:
  register_build_artifacts:
    steps:
      - name: Register Build Artifacts
        uses: cloudbees-io/register-build-artifacts@main
        id: register
        with:
          artifact-metadata: |
            [
              {
                "name": "myApp",
                "version": "1.0.0",
                "url": "docker.io/myapp/myimg:1.0.0",
                "type": "docker"
              }
            ]
Multiple artifacts example
jobs:
  register_build_artifacts:
    steps:
      - name: Register Build Artifacts
        uses: cloudbees-io/register-build-artifacts@main
        id: register
        with:
          artifact-metadata: |
            [
              {
                "name": "myApp",
                "version": "1.0.0",
                "url": "docker.io/myapp/myimg:1.0.0",
                "type": "docker"
              },
              {
                "name": "myService",
                "url": "docker.io/myorg/myservice:2.3.4",
                "version": "2.3.4",
                "labels": [
                  "api",
                  "custom, label",
                  "\"custom label\"",
                  "backend:v1"
                ],
                "repositoryUrl": "https://github.com/example/myservice.git",
                "commitId": "789xyz654wvu",
                "ref": "refs/tags/v2.3.4",
                "digest": "sha256:abcdef1234567890",
                "componentId": "fa0592f9-88f8-4f5d-9f37-580a93ba55ce",
                "type": "docker"
              }
            ]
Using output parameters
- name: Register artifacts 2
  id: register
  uses: cloudbees-io/register-build-artifacts@main
  with:
    artifact-metadata: |
      [
        {
          "name": "myApp2",
          "version": "1.0.02",
          "url": "docker.io/myapp/myimg:1.0.02"
        }
      ]
- name: Print output parameter artifact IDs
  uses: docker://alpine:latest
  shell: sh
  run: |
    echo "Artifact IDs: ${{ steps.register.outputs.artifact-ids }}"

License

This code is made available under the MIT license.

References

About

Use this action to register build artifact versions with a workflow run

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •