Multi-stage pipelines

Gates, as they are available for classic releases, are present in multi-stage YAML pipelines. In YAML pipelines, another mechanism is available: checks. Checks are configured to automatically validate if one or more conditions are met before allowing a pipeline to continue. Checks can be added to resources that are used in a stage. If one or more checks are found on one or more resources in a stage, all of the checks have to be passed before the pipeline continues to that stage. Checks can be added to environments and service connections.

To add a check to an environment, navigate to that environment:

 Now perform the following steps:

  1. At the top-right, expand the menu and choose Approvals and checks:
  2. In the new view that opens, choose See all to see all of the different types of checks that are available. Choose Invoke Azure Function:

  1. In the popup that opens, configure the Azure function to be called. At a minimum, the function URL and key have to be provided.
  2. Choose Create.

Once the check is created, every deployment job (see Chapter 4, Continuous Deployment) that targets the environment has to pass this check. The check is passed when the function that is called returns a successful response code.

The following types of checks are supported:

  • Evaluate artifact: Validate that an artifact of the type container image passes a custom policy. These policies are defined in a language called Rego.
  • Invoke REST API: Post details about the pipeline to an Azure function to execute custom logic. If the API returns a successful HTTP status code, the pipeline is allowed to continue.
  • Invoke Azure Function: The same as the Invoke REST API check, but with some defaults for Azure Functions.
  • Query Azure Monitor alerts: Only continue if the specified alerts are not in an active state.
  • Required template: Only allow the pipeline to continue if the current YAML pipeline extends one or more configured base YAML pipelines.

Checks can be a powerful mechanism for guaranteeing that one or more conditions are met before allowing a pipeline to continue.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.211.87