Evaluating gates
You can evaluate gates by using other continuous integration and continuous delivery (CI/CD) tools with the IBM Cloud® command line interface (CLI) to integrate with IBM Cloud® DevOps Insights. DevOps Insights gates check whether your test results comply with a defined policy. If the policy is not met, the DevOps Insights gate fails by default. You can also configure gates to act in an advisory role to allow CI/CD tool progression even after failure.
Before you begin
Before you evaluate a gate policy on an application build, you must publish test records. For more information, see Publishing test results by using other CI/CD tools.
Create a policy with rules. For more information, see Defining policies and rules.
Defining gates for other CI/CD tools
Place gates before build promotion in your CI/CD tool to check the quality of the build against your policies to ensure that it's safe to promote from one environment to another. Use the gate-evaluate
command to perform the gate
check.
After you create the policy, you can use the following script for gate evaluation:
#install the DevOps Insights plugin
ibmcloud plugin install -f doi
# Log in to IBM Cloud if you are not already logged in. Assumes that $API_KEY environment variable has been set
ibmcloud login --apikey $API_KEY --no-region
# The following line assumes that MY_APP_NAME and MY_BUILD_NUMBER environment variables have already been set. POLICY is the name of the policy being evaluated.
ibmcloud doi gate-evaluate --logicalappname="$MY_APP_NAME" --buildnumber="$MY_BUILD_NUMBER" --policy POLICY
Viewing gate evaluation
You can view the results of the gate evaluation on the Risk Analysis page in DevOps Insights. The Risk Analysis page relies on the presence of a gate after a staging deployment job. Make sure that you have a gate after you deploy to the staging environment, but before you deploy to a production environment. For more information about the Risk Analysis page, see Your deployment environments.