Register and view build artifacts

3 minute read

By registering build artifact metadata to CloudBees Unify, teams can view and manage artifact information, including compiled binaries, configurations, and log files. Configure your CI pipeline to register build artifacts to CloudBees Unify, including the version, digest, location, labels, and commit details, if applicable.

Configure your Multibranch Pipeline to register build artifacts

Register any outputs of your integrated CI pipeline build workflow run, such as compiled binaries and log files, to CloudBees Unify.

To register artifacts from your CI build to CloudBees Unify:

  1. Complete the five steps in Get started with CloudBees CI / Jenkins® and CloudBees Unify.

  2. Specify a registerBuildArtifactMetadata step in your Jenkinsfile that contains the required inputs listed in the table below:

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

    name

    String

    Yes

    The name of the artifact reported to CloudBees Unify.

    url

    String

    Yes

    The URL where the artifact version is located. For example, docker.io/myapp/myimg:1.0.0.

    version

    String

    Yes

    The version of the artifact to send to CloudBees Unify for artifact traceability purposes.

    digest

    String

    No

    The hash or checksum that uniquely identifies the artifact version.

    CloudBees recommends specifying the digest to track artifact versions across repositories. For more information, refer to Artifact deployment and publish history.

    label

    String

    No

    A comma-separated list of artifact labels.

    type

    String

    No

    The type of artifact, such as Docker or Maven.

    componentId

    String

    No

    The ID of the component associated with the artifact. If not provided, the default value is the component ID where the CloudBees CI / Jenkins workflow is located.

    commit

    String

    Only required if a different repository/branch.[1]

    The commit used to build the artifact. The default value is the commit hash from the CloudBees CI / Jenkins build.

    commitUrl

    String

    Only required if a different repository/branch.[1]

    The URL of the commit used to build the artifact. The default value is the commit URL from the CloudBees CI / Jenkins build.

    repositoryUrl

    String

    Only required if a different repository/branch.[1]

    The URL of the repository. The default value is the repository URL from the CloudBees CI / Jenkins build.

    ref

    String

    Only required if a different repository/branch.[1]

    The branch or tag ref used to build the artifact. The default value is the ref from the CloudBees CI / Jenkins build.

    [1] By default, the artifact version is associated with the code commit from the CI build. If a different commit/repository/branch has been checked out for building the artifact, specify those commit details instead. If you do not want to associate commit details with this artifact version, omit this parameter.

Usage examples

The following is a basic example of using the registerBuildArtifactMetadata step with only the required parameters:

pipeline { agent any stages { stage('Registering build artifact') { steps { echo 'Registering the metadata' registerBuildArtifactMetadata( name: "my-artifact", url: "https://my-artifact-url.com", version: "1.0.0" ) } } } }

The following example specifies optional parameters:

pipeline { agent any stages { stage('Registering build artifact') { steps { echo 'Registering the metadata' registerBuildArtifactMetadata( name: "my-Docker-artifact", url: "https://hub.docker.com/repository/docker/example", version: "1.0.0", digest: "sha256:abcdef1234567890", label: "staging,prod", type: "Docker", componentId: "e04f06b0-992c-4267-b133-91092b252845", commit: "1234abcd-ab34-123cd-56ef-12345678abcd", commitUrl: "https://github.com/example/repo/commit/1234abcd-ab34-123cd-56ef-12345678abcd", repositoryUrl: "https://github.com/example/repo", ref: "refs/heads/main" ) } } } }

View CI build artifacts

View artifacts from your CI build in the same platform as all your other DevOps projects.

To view the artifacts for a build, do one of the following:

  • Access the details for your CI build, and then select Build artifacts to list only the artifacts generated during that build.

  • Select your component, and then select Artifacts to list all artifacts associated with a component. Choose to display just the latest versions or the entire version history.

CI build artifacts
Figure 1. A CI build artifact list.

Learn more

For more information on artifacts, refer to: