Entry and Exit Gates

4 minute readDeveloper productivity

Gates at the entries and exits of the stages control the pipeline’s progress:

  • An entry gate controls whether a stage may begin and its tasks may be executed.

  • An exit gate controls whether the stage may be completed and the pipeline may progress.

Gate approvals are optional; if a gate has no approvals, the pipeline’s progress continues. Gate approvals can be either manual (where the approver must physically click the approval to move to the next stage) or automated (based on whether specific criteria are met) or a combination of both.

Manual Gate Approvals

During a pipeline run, you can use the pipeline stage summary to see pipeline progress at each stage. You can review the user-generated information in the summary to make approval or rejection decisions at a gate. If a gate has approvals, one or more of these actions occurs:

  • Email notifications are sent to the specified approvers.

  • If the approver approves the request, the pipeline’s progress continues.

  • If the approver rejects it, the pipeline ends with an appropriate error (except if On Rejection is set to Continue running ).

You can configure specific users or groups to be allowed to manually approve the criteria at a gate as follows:

  • You can set the approvals so that approval from only approver is sufficient for the pipeline to progress. In this case, you can have one approval rule and have all the approvers assigned to that rule.

  • You can set the minimum number of people required to approve from a group.

    If you want all the key individuals to approve sequentially, you can specify multiple approval rules, each for a specific user.

  • In addition to specific users, you can apply approval rules to groups. Approval or rejection from any user in the group lets the pipeline progress or stops it.

  • When defining a gate, you must specify whether the pipeline continues or stops if the approval is rejected. To do so, you must select one of the following under the On Error field:

    • Continue running : If the user rejects the gate approval, the pipeline completes the task and then continues to the next gate or stage task with a known error.

    • Stop running : If the user rejects the gate approval, then the pipeline aborts. This behavior usually occurs in continuous delivery pipelines.

For example, if your pipeline has multiple stages for testing, you might want to set entry and exit criteria for each stage to ensure that the code is testing properly in the software delivery life cycle.

  • In the system test stage, the QA engineer must approve the start of the system testing workflow. That user or someone else in the QA group can review the system test results before approving the exit criteria.

  • Before anything can enter the production stage, you should have entry gate approvals by various individuals.

For information about adding manual gate approvals, see Creating a Manual Approval Rule in a Gate .

Automated Gate Approvals

Automated approvals lets you set criteria that must be met before code is promoted to later stages. For audits, automated approvals let you show that these criteria were met. You can specify promotion criteria that are fully automated based on whether a condition is met or a combination of automated conditions and manual approvals. You can specify automated criteria that are based either on the outcome of a procedure of your choice or the outcome of a condition that you specify.

Procedure-Based Criteria

Procedure-based criteria allow you to call any procedure. These criteria let you query third party systems and implement complex gating rules. The job status corresponding to the procedure being executed determines the gate task outcome. A job outcome of Success (finished with no errors) is considered to be approved. A job outcome of Warning, Failure, or any other non-success job status is considered to be rejected. You can call procedures and pass in all the required parameters. For information about adding procedure-based gate approvals, see Creating a Procedure-Based Approval Rule in a Gate .

Condition-Based Criteria

You can create criteria based on custom conditions of your choice that evaluate to true or false to approve or reject gates. A condition is a Javascript expression that leverages properties. You can specify criteria based on any intrinsic properties that are appropriate for a release pipeline and a pipeline runtime. For example, you can create a property on the pipeline runtime based on the output of a test suite and write an expression to evaluate whether the property is 50 or greater (pass) or less then 50 (fail). For examples of Javascript expressions, see the KBEC-00360 - Using Context-Relative Shortcuts to Properties on Pipelines and related objects KB article.

For information about adding condition-based gate approvals, see Creating a Condition-Based Approval Rule in a Gate .

Automated Gate Approval Examples

  • Simple automated gate criteria—The previous stage finishes with a successful status, and the next stage should proceed.

  • Sophisticated automatic gate criteria—Based on a custom calculation or script result, the next stage should proceed. For example, if the performance test results show no more than a 5% degradation over the last main release or if all failed unit tests are marked exempt.

  • Combination of automated criteria and manual approval—Based on performance tests passed and QA manual approval. For example:

    • Test results-based condition—Move to the next stage if greater than 90 percent of tests have passed.

    • If 80-90 percent of tests passed, require manual approval.

    • If less than 80 percent of tests passed, reject the gate.

  • External trigger. For example, wait until a ServiceNow ticket is approved to trigger gate approval and promote to the next stage.