Skip to content

Quality gate

A quality gate is a service that is used to check the quality gate status of workflows. Exposes one user-facing endpoint that can be queried to get quality gate info on workflows.

A quality gate is a set of rules a workflow execution must satisfy.

An implementation may provide a quality gate service.

Endpoint

The quality gate service exposes one endpoint: Qualitygate. It returns Status messages.

Qualitygate

The request is a GET type request.

GET /workflows/{workflow_id}/qualitygate[?mode=strict|passing]

If mode is not specified, strict is assumed.

The possible return codes are: OK (200), Invalid (422), Unauthorized (401), or NotFound (404).

If the request is accepted (status is Success), details.status must contain the quality gate status for the workflow. That status must be one of:

  • SUCCESS: the workflow has succeeded and passes the quality gate.
  • NOTEST: the workflow has succeeded, but it produced no test result.
  • FAILURE: the workflow has failed, or failed the quality gate.
  • RUNNING: the workflow execution is still ongoing.

Modes

The quality gate service allows for multiple ‘modes’ (sets of rules). Two modes must be available: strict and passing.

  • strict means a workflow will pass the quality gate if and only if it has completed successfully and all test cases were OK. (It implies that a workflow with no test case will pass the quality gate if it has completed successfully).

  • passing means a workflow will pass the quality gate if it has completed successfully, event if some test cases were not OK.

If no mode is specified, strict is used.

An implementation may propose additional modes.

Workflow statuses examples

This is a status manifest for a workflow with at least one failed test, using the passing mode. As long as the workflow has completed successfully, it will pass the quality gate:

curl \
  http://127.0.0.1/workflows/5dcc66dd-5d0d-4dcf-9b18-f39eafc0f279/qualitygate?mode=passing
{
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Success",
    "message": "",
    "details": {
        "status": "SUCCESS"
    },
    "code": 200,
}

This is a status manifest for same workflow, using the default (strict) mode. As it has at least one failed test, it fails that quality gate:

curl \
  http://127.0.0.1/workflows/5dcc66dd-5d0d-4dcf-9b18-f39eafc0f279/qualitygate
{
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Success",
    "message": "",
    "details": {
        "status": "FAILURE"
    },
    "code": 200,
}