Register a deployed artifact in CloudBees Unify

3 minute read

By registering deployed artifact metadata to CloudBees Unify, teams can track and manage artifact deployments across different environments. This enables DORA metrics, environment inventory tracking, and deployment analytics for artifacts deployed through CloudBees CI or Jenkins workflows. Configure your CI pipeline to register deployed artifacts to CloudBees Unify with the artifact identifier, target environment, and labels.

Configure your Multibranch Pipeline to register deployed artifacts

Register the deployment of your artifacts to track which versions have been deployed to specific environments.

To register deployed artifacts from your CI pipeline to CloudBees Unify:

  1. Integrate your controller or operations center with CloudBees Unify by completing the steps in Integrate a single controller with CloudBees Unify or Integrate multiple controllers via the CloudBees CI operations center.

  2. Register your build artifact using the registerBuildArtifactMetadata step to obtain the artifact ID.

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

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

    artifactId

    String

    No

    The artifact’s ID, returned as the output value of the registerBuildArtifactMetadata step. For example, def artifactId = registerBuildArtifactMetadata(…​). Either this or artifactUrl must be present.

    artifactUrl

    String

    No

    URL of the deployed artifact. Either this or artifactId must be present.

    targetEnvironment

    String

    Yes

    The artifact’s target environment. The environment must already be configured in CloudBees Unify.

    labels

    String

    No

    Comma-separated labels attached to the artifact (for example, latest).

    allowNoMatchingComponent

    Boolean

    No

    If set to false (the default), this step fails if the component is not registered in CloudBees Unify. If set to true, this step succeeds even if the component doesn’t exist, logging the error instead..

Usage examples

The following is a basic example of using the registerDeployedArtifactMetadata step with the artifact ID:

pipeline { agent any stages { stage('Registering deployed artifact') { steps { echo 'Registering the deployment metadata' registerDeployedArtifactMetadata( artifactId: "12345678-1234-1234-1234-123456789abc", targetEnvironment: "production" ) } } } }

The following example uses the artifact URL and includes optional parameters:

pipeline { agent any stages { stage('Registering deployed artifact') { steps { echo 'Registering the deployment metadata' registerDeployedArtifactMetadata( artifactUrl: "https://hub.docker.com/repository/docker/example", targetEnvironment: "production", labels: "latest", allowNoMatchingComponent: true ) } } } }

Full pipeline and run example

Running this pipeline creates a build artifact that is reported to CloudBees Unify, and then registers its deployment.

Example Jenkinsfile
pipeline { agent any stages { stage('Compile code') { steps { echo 'Compiling...' } } stage('Produce binary') { steps { echo 'Generating binary...' } } stage('Push binary') { steps { echo 'Pushing binary to ECR...' } } stage('Register build artifact') { steps { script { env.ARTIFACT_ID = registerBuildArtifactMetadata( name: "my-artifact", version: "1.0.0", url: "docker.io/example:latest", type: "docker" ) } } } stage('Deploy artifact') { steps { echo "Deploying artifact ID: ${env.ARTIFACT_ID}" } } stage('Register deployed artifact') { steps { registerDeployedArtifactMetadata( artifactId: env.ARTIFACT_ID, targetEnvironment: "production", labels: "latest" ) } } } }

After the run completes, the artifact information is displayed in the Run details  Deployments tab in CloudBees Unify.

View deployed CI build artifacts

To view the deployed artifacts for a build:

  1. Select the organization and component associated with the CI build.

  2. Select Components  Runs.

  3. Select the build name to view the build details in Runs  Run details.

  4. Select Deployments to list only the deployed artifacts generated during that build.

Learn more

For more information on artifacts, refer to: