Azure Pipeline Part 8 – Templates Parameters

Azure Pipeline Part 8 – Templates Parameters

Azure Pipeline Part 8 – Templates Parameters

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

Today we are going to discuss how to modularize your Azure Pipeline config YAML file using templates and parameters.

Azure Pipeline Part 8 – Templates Parameters

Prerequisites:

Setup:

Azure Pipeline – Templates:

Templates let you define reusable content, logic, and parameters. Templates function in two ways. You can insert reusable content with a template or you can use a template to control what is allowed in a pipeline.

If a template is used to include content, it functions like an include directive in many programming languages. Content from one file is inserted into another file. Azure pipeline supports templating of Stage, Jobs, Steps, and Variables. A template file can include another template file. Azure Pipelines supports a maximum of 50 unique template files in a single pipeline.

When a template controls what is allowed in a pipeline, the template defines logic that another file must follow.

Azure Pipeline – Parameters:

You can specify parameters and their data types in a template and pass those parameters to a pipeline. Parameters must contain a name and data type. You can specify parameters and their data types in a template and pass those parameters to a pipeline.

Azure Pipeline – Stage Templates:

You can define a set of stages in one file and use it multiple times in other files.

Azure Pipeline – Stage Templates Syntax:

Azure Pipeline – Stage Templates Example:

Azure Pipeline – Job Templates:

You can define a set of jobs in one file and use it multiple times in other files.

Azure Pipeline – Job Templates Syntax:

Azure Pipeline – Job Templates Example:

Azure Pipeline – Step Templates:

You can define a set of steps in one file and use it multiple times in another file.

Azure Pipeline – Step Templates Syntax:

Azure Pipeline – Step Templates Example:

Azure Pipeline – Variable Templates:

You can define a set of variables in one file and use it multiple times in other files.

Azure Pipeline – Variable Templates Syntax:

Azure Pipeline – Variable Templates Example:

Clean up:

Hope you have enjoyed this article. To know more about Azure DevOps, please refer below official documentation

https://docs.microsoft.com/en-us/azure/devops/?view=azure-devops

Leave a Reply

Close Menu