---
name: ContinuousDelivery-cli_publish_build
title: Publishing a build record
description: Build records notify IBM Cloud&reg; DevOps Insights when a build is complete. This record contains the application name, branch, build ID, reference to Git repo, and other fields. You must publish build records to view any test records, deployment records, or evaluate policies in DevOps Insights.
last-updated: 2022-03-24
---

> ## Documentation Index
> The table of contents for this documentation set is at https://cloud.ibm.com/docs/ContinuousDelivery?format=markdown
> The index for all IBM Cloud docs is at: https://cloud.ibm.com/docs/llms.txt
> Use these files to discover more information as needed.

{:shortdesc: .shortdesc}
{:screen: .screen}
{:codeblock: .codeblock}
{:tip: .tip}
{:note: .note}
{:important: .important}
{:pre: .pre}

# Publishing a build record
{: #publish-build-cli}

DevOps Insights will reach end of service and be discontinued on **August 31, 2026**. After this date, the service will no longer be available. New DevOps Insights tool integrations can no longer be created. [Learn more](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-faq_region_feature_consolidation&format=markdown)
{: important}

Build records notify IBM Cloud&reg; DevOps Insights when a build is complete. This record contains the application name, branch, build ID, reference to Git repo, and other fields. You must publish build records to view any test records, deployment records, or evaluate policies in DevOps Insights.  
{: shortdesc}


## Before you begin
{: #prereq-build-cli}

[Set consistent parameter values](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-setting-values-cli&format=markdown).


## Uploading a build record
{: #upload-build-cli} 

In a build job, use the following script to upload a build record.

```bash
#!/bin/bash

#install the latest version of DevOps Insights plugin
ibmcloud plugin install -f doi

# Login to IBMCloud if you are not already logged in.  Assumes that $API_KEY environment variable has been set as a secured property in environment variable
ibmcloud login --apikey $API_KEY --no-region

# $GIT_BRANCH, $GIT_URL, $GIT_COMMIT are environment variables made available by the Continuous Delivery pipeline
# Assumes you have set $MY_APP_NAME and $MY_BUILD_NUMBER as described earlier

ibmcloud doi buildrecord-publish --logicalappname="$MY_APP_NAME" --buildnumber="$MY_BUILD_NUMBER" --branch $GIT_BRANCH --repositoryurl $GIT_URL --commitid $GIT_COMMIT --status pass
```
{: codeblock}

The `status` field takes the values `pass` or `fail`.
{: tip}


## Viewing the build frequency
{: #build-frequency-cli}

When the build job completes, the pipeline publishes a message to DevOps Insights that a build is complete. You can view the build record on the Build Frequency page. 

1. From the IBM Cloud console, click the **Menu** icon ![hamburger icon](images/icon_hamburger.svg) > **Resource list**.
2. Select your toolchain.
3. From your toolchain's Overview page, on the **IBM Cloud tools** card, click **DevOps Insights**.
4. Click **Build Frequency** in the navigation.


## Next steps
{: #next-build-cli} 

[Publish a deployment record](https://cloud.ibm.com/docs/ContinuousDelivery?topic=ContinuousDelivery-publish-deploy-cli&format=markdown).