Understanding the YAML pipeline

In the previous section, we used the classic editor to create a pipeline to show you the different parts of the pipeline and to give you an idea of what the pipeline is. But creating a pipeline in the editor is not very convenient, and you cannot version the definition. This is why YAML pipelines exist. They have the same properties and parts as the classic pipelines but are defined by a YAML file as part of your source code. This means you can define Pipelines as Code (you can directly code a pipeline) and you can use all of the tools you are using to work with your code.

First, here's some information about YAML. YAML is a file syntax like XML and JSON, but it is primarily focused to be read by humans (XML and JSON are defined to be read by computers). This means that the syntax is easily understandable. Instead of artificial marks to give meaning, it uses indentation and symbols such as - for list items and : to separate names and values:

If you look at the example, you should be able to recognize the properties (the format is name: value), objects with properties (for example, customer in the preceding screenshot), and lists (items in the preceding screenshot) with objects.

By using YAML, you can define all of the parts of the pipeline you saw in the pipeline editor:

  • Jobs and tasks with parameters and properties
  • Variables, including variable groups
  • Triggers

If you created some pipeline in the editor, you can use the View YAML button in the editor to see the YAML that defines the same thing as you have in the editor. In this way, you can start creating your YAML pipeline. Just create an azure-pipelines.yaml file in your project, put the pipeline description into it, and commit the file into your repository.

When you want to change something in the pipeline, change the YAML file, commit, and push. The pipeline will change automatically.

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

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