Publishing a build record (deprecated)
You can publish a build record by using idra (deprecated) to integrate your Delivery Pipeline with IBM Cloud® DevOps Insights. Build records notify DevOps Insights when a build is complete. This record contains the application name, branch, build
ID, reference to Git repo, and more. You must publish build records to view any test records, deployment records, or evaluate policies in DevOps Insights.
DevOps Insights tracks deployment risk based on published test data. When you integrate DevOps Insights with your Delivery Pipeline, you are instrumenting DevOps Insights to gather information from the pipeline. Information that is gathered from the pipeline is presented in DevOps Insights dashboard to provide visibility into your DevOps process.
DevOps Insights requires the following information from your pipeline to analyze deployment risk:
- Build records
- Deployment records
- Test results
Before you begin
You must configure Delivery Pipeline in your toolchain to build, test, and deploy. For more information, see Configuring Delivery Pipeline.
Publishing a build record (deprecated)
In the last build job, use the following script to upload a build record.
#!/bin/bash
# Add user api key to stage environment variable as a secured property
export LOGICAL_APP_NAME="SampleApp"
export BUILD_PREFIX="master"
# $GIT_BRANCH, $GIT_URL, $GIT_COMMIT are environment variables made available by the CD pipeline
# node 4.x or above is needed
export PATH=/opt/IBM/node-v4.2/bin:$PATH
npm install -g grunt-idra3
idra --publishbuildrecord --branch=$GIT_BRANCH --repositoryurl=$GIT_URL --commitid=$GIT_COMMIT --status=pass
Environment variables that you define in the pipeline provide context for publishing these records. You can define them by using the export
command in your jobs' scripts. You can also set them in each pipeline stage's Environment
Properties menu.
Environment Variable | Purpose | Required |
---|---|---|
IBM_CLOUD_API_KEY |
The IBM Cloud user's API key. | All jobs that start the idra CLI and enforce DevOps Insights risk policies. |
LOGICAL_APP_NAME |
The app's name on the dashboard. | All jobs that build, test, deploy, and enforce DevOps Insights risk policies. |
BUILD_PREFIX |
Text that is added as a prefix to the stage's builds. This text also appears on the dashboard. | All jobs that build, test, deploy, and enforce DevOps Insights risk policies. |
Be sure to use these variables consistently:
- The
IBM_CLOUD_API_KEY
is similar to a password; add it to each Continuous Delivery pipeline stage environment as a Secure property. - For a particular application, use the same
LOGICAL_APP_NAME
in all jobs or stages. - Make sure that the
BUILD_PREFIX
is the same for a particular app and build type. For example, for builds from the master branch,BUILD_PREFIX
might be"master"
.
Viewing build frequency
When this 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. To view the Build Frequency page, use the following steps.
- From the IBM Cloud console, click the Menu icon
> Platform Automation > Toolchains.
- Select your toolchain.
- From your toolchain's Overview page, on the IBM Cloud tools card, click DevOps Insights.
- Click Build Frequency.
Next steps
Learn how to publish a deployment record by using idra (deprecated).