Motivation
Complex CI configurations housed in large YAML files take a lot of work to maintain and modify. Azure templates extract chunks of logic from larger configurations and encapsulate them in external template files. The template can then be referenced in multiple configurations, keeping pipelines more readable and maintainable. This guide explains how to:- Create template files to run various Semgrep commands.
- Include or call templates in your Azure Pipeline.
Defining Semgrep commands in a template file
To add Semgrep commands in a YAML template file:NOTEYou must define separate templates for full scans and diff-aware scans. This is because there are different environment variables used in the template for diff-aware scans, such as
SEMGREP_PR_ID and SEMGREP_BASELINE_REF.