IBM Cloud Docs
Working with DevOps Insights

Working with DevOps Insights

IBM Cloud® DevOps Insights is a tool that aggregates code, test, build, and deployment data to provide visibility of quality for all of your teams. This tutorial walks you through the quickest steps for setting up DevOps Insights with IBM Cloud® Continuous Delivery so that you can explore the features in DevOps Insights.

With DevOps Insights, you can maintain and improve the quality of your code in IBM Cloud®. You can monitor your deployments to identify risks before they are released, analyze development changes for error probability, and improve the interactions of your team.

DevOps Insights collects and analyzes the results from unit tests, functional tests, and code coverage tools. It uses these results to determine whether your code meets predefined policies at specified gates in your deployment process. If your code does not meet or exceed a policy, the deployment is halted, preventing risks from being released. You can use DevOps Insights as a safety net for your continuous delivery environment or as a way to implement and improve quality standards.

Before you begin

Authorize the use of GitHub repos. For more information, see Authenticating with Git Repos and Issue Tracking.

Step 1. Add the toolchain by using a template

  1. From the IBM Cloud console, click the Menu icon hamburger icon > Platform Automation > Toolchains.
  2. Expand the Location menu, and select a location for your deployment. DevOps Insights is available in Dallas, London, and Frankfurt.
  3. Click Create a Toolchain.
  4. Select the DevOps Insights Quick Start Demo tile.
  5. In the Tool Integrations section, create an API key for Delivery Pipeline.
  6. Click Create to finish creating the toolchain.

If you need to authorize IBM Cloud to use GitHub, click GitHub > Authorize.

You can also create and manage a toolchain that includes a DevOps Insights tool integration by using Terraform. For more information about using Terraform, see Setting up Terraform for Continuous Delivery.

Step 2. Run a build to send data to DevOps Insights

You run builds to see data within DevOps Insights. When you created this template, a build ran automatically in the Delivery Pipeline. You will see data within DevOps Insights after the build stage completes.

Click the Delivery Pipeline tile to view the build process. The process might take several minutes to finish. When the build stage completes, continue to step 3.

For more information about pipelines, see Delivery Pipeline overview.

Step 3. View the data analyzed by DevOps Insights

Explore the Quality Dashboard page to see the data aggregated from Delivery Pipeline. The quality dashboard provides quality data sets for each application.

  1. Click the Menu icon hamburger icon > Platform Automation > Toolchains.
  2. On the Toolchains page, click the DevOps Insights toolchain to open its Overview page.
  3. On the IBM Cloud tools card, click the DevOps Insights tool integration.
  4. Click Quality Dashboard.

You can view details about the Weather Application and the quality of the code that was analyzed. These tests are available where the policy gates passed: code coverage, unit test, and the functional verification test. You can click the build ID, for example, master:1, to view a summary for that specific test. Click View trends to view trend details.

For more information about the quality dashboard, see DevOps data aggregation.

Step 4. Test a gate against a DevOps Insights policy decision

A gate is created when you enact a policy. A policy is a set of rules that you can customize, and a rule is the passing criteria that you define for each type of test data you upload. The gate passes or fails a build based on the quality standards that you choose. So, if your code doesn't meet or exceed a policy that is enacted at a particular gate, the deployment is stopped to prevent risky changes from being released.

For the Weather Application, the code coverage rule set for the policy is that the minimum code coverage required is 80%. The gate is placed before the production stage within the pipeline. When you first create this template, the app passes all current gates, but gates sometimes fail.

To make a gate fail, edit the code in the routes/apivl.js file so that the code coverage reaches only 60%. The gate fails because the code doesn't reach the necessary quality and deployment isn't pushed to production.

  1. Open the routes/apivl.js file in an editor.
  2. Uncomment lines 42-72 and save the file.
  3. From a Git client, commit and push your changes.
  4. On your toolchain's Overview page, on the IBM Cloud tools card, click the DevOps Insights tool integration to observe the gate fail in real time.

Step 5. Analyze the failed gate

The gate fails because the code coverage isn't met. When you gate your own deployments, you can determine whether it failed or passed by looking at the Risk Analysis page. Also, you can define, change, and customize policies and rules to fit your needs when it comes to gating deployments. View the policies and rules that make the gate.

  1. Click the Menu icon hamburger icon > Platform Automation > Toolchains.
  2. On the Toolchains page, click the DevOps Insights toolchain to open its Overview page.
  3. On the IBM Cloud tools card, click the DevOps Insights tool integration.
  4. Click Policies > Weather Unit Test, Code Coverage, and FVT Checks.
  5. Click Code coverage to view the minimum code coverage required. Anything equal to or over 80% will release to the next stage.
  6. Click Risk analysis to check whether your deployment passed or failed the gate. Risk is evaluated based on the defined policies within DevOps Insights.
  7. Select the build with the failed policy to view the test summary details.

Next steps

You might want to create your own toolchain with DevOps Insights or add DevOps Insights to an existing project. For more information, see Adding DevOps Insights to your toolchain.