Evaluating gates
You can evaluate gates by using Jenkins to integrate your project 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 pipeline 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 Jenkins.
- Create a policy with rules. For more information, see Defining policies and rules.
Defining gates
Add gates to your pipeline by using the evaluateGate
command. Gates enforce DevOps Insights policies, which set test requirements for build promotion.
This step requires one parameter. It can also accept two of the three optional parameters. The follow is a list of parameters and their definitions.
Parameter | Definition |
---|---|
policy |
The name of the policy that the gate implements. The policy's name is defined in DevOps Insights. |
forceDecision |
Optional: Set this parameter to true to stop the pipeline if the gate fails. Set it to false to force the pipeline to continue after a gate fails. By default, the value is false. |
buildNumber |
Optional: Set value to any string to represent a version number. |
applicationName |
Optional: Set the application name. When this value is set, the environment variable IBM_CLOUD_DEVOPS_APP_NAME is ignored. |
The following example command includes the parameters. In this command, the pipeline continues running regardless of the gate's decision.
evaluateGate policy: 'Weather App Policy', forceDecision: 'true'
Viewing gate evaluation
You can view the results of the gate evaluation on the Risk Analysis page in the DevOps Insights console. The Risk Analysis page relies on the presence of a gate after a staging deployment job in your pipeline. 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.
Next steps
After you evaluate your gates, send the pipeline status to IBM.