Azure DevOps YAML Schema

Share

Azure DevOps YAML Schema

Azure DevOps uses YAML pipelines to define and manage Continuous Integration/Continuous Deployment (CI/CD) workflows. The YAML schema for Azure DevOps pipelines is defined in the YAML file where you configure your build and release pipelines. Here are some key elements and components of the YAML schema:

  1. Triggering Events:

    • trigger: Defines the events that trigger the pipeline. Common triggers include code pushes (push) to specific branches, pull requests (pr), or scheduled builds (schedule).
  2. Variables:

    • variables: Allows you to define variables that can be used throughout the pipeline. Variables can be defined as secret or non-secret and are typically used for storing environment-specific values.
  3. Jobs:

    • jobs: Represents a collection of steps that run sequentially or in parallel.
    • job: Defines a single unit of work within a job.
    • strategy: Allows you to specify matrix builds for multiple configurations.
  4. Steps:

    • steps: Contains a list of individual steps that define tasks to be executed in the job.
    • Each step can have a name, displayName, script, task, or other properties.
    • script: Allows you to define custom scripts (e.g., PowerShell, Bash) to run as part of the job.
  5. Environment:

    • environment: Specifies the target environment for deployment.
    • Environments can have approval checks and other deployment-related settings.
  6. Deployment Jobs:

    • deployment: Defines a deployment job for deploying your application.
    • Includes settings like strategy, pool, resources, and environment.
  7. Services:

    • services: Specifies services that the job relies on, such as containers or other services in a Docker Compose file.
  8. Conditionals and Expressions:

    • Use conditionals and expressions to control the flow of your pipeline based on variables or other criteria.
  9. Triggers for Deployment:

    • dependsOn: Specifies which jobs or stages must complete successfully before a job can start.
    • condition: Allows you to specify conditions for running a job or a step.
  10. Deployment Strategies:

    • Use strategy and parallel to define deployment strategies like blue-green deployments or canary releases.
  11. Environment Approval:

    • environment can have approvals to require manual approval before deploying to a particular environment.
  12. Agent Pools:

    • pool: Specifies the agent pool where the job runs.
  13. Resources:

    • resources: Defines additional resources required for the job, such as containers or virtual machines.
  14. Custom Tasks:

    • You can use custom tasks or predefined tasks from the Azure DevOps task library.
  15. Parameters:

    • Use parameters to make your pipeline more flexible and reusable.
  16. Templates:

    • Templates allow you to define common pipeline configurations and reuse them across multiple pipelines.
  17. Multi-Stage Pipelines:

    • Azure DevOps supports multi-stage pipelines, allowing you to define build and release stages in a single YAML file.

Example YAML Structure:

Here’s a simplified example of an Azure DevOps YAML pipeline:

yaml
trigger: - main variables: - name: 'BuildConfiguration' value: 'Release' jobs: - job: Build displayName: 'Build Job' steps: - script: | echo "Building the application..." # Add build commands here displayName: 'Build Application' - job: Deploy displayName: 'Deploy Job' dependsOn: Build environment: 'Production' strategy: runOnce: deploy: steps: - script: | echo "Deploying the application..." # Add deployment commands here displayName: 'Deploy Application'

This is a basic structure, and Azure DevOps YAML pipelines can become more complex as you add more jobs, steps, conditions, and customizations to meet your specific CI/CD requirements.

Demo Day 1 Video:

You can find more information about DevOps in this DevOps Link

 

Conclusion:

Unogeeks is the No.1 IT Training Institute for DevOps Training. Anyone Disagree? Please drop in a comment

You can check out our other latest blogs on  DevOps here – DevOps Blogs

You can check out our Best In Class DevOps Training Details here – DevOps Training

💬 Follow & Connect with us:

———————————-

For Training inquiries:

Call/Whatsapp: +91 73960 33555

Mail us at: info@unogeeks.com

Our Website ➜ https://unogeeks.com

Follow us:

Instagram: https://www.instagram.com/unogeeks

Facebook:https://www.facebook.com/UnogeeksSoftwareTrainingInstitute

Twitter: https://twitter.com/unogeeks


Share

Leave a Reply

Your email address will not be published. Required fields are marked *