Azure Pipelines Predefined Variables

Share

Azure Pipelines Predefined Variables

Azure Pipelines, part of Azure DevOps, provides a set of predefined variables that are automatically set during the pipeline execution. These variables can be incredibly useful for customizing and controlling the behavior of your CI/CD pipeline. Here’s an overview of some key predefined variables in Azure Pipelines:

  1. Build Variables: These include variables such as Build.BuildId, Build.BuildNumber, Build.DefinitionName, Build.Repository.Name, etc., providing information about the build, such as its ID, the build number, the name of the build definition, and the repository name.

  2. Agent Variables: Variables like Agent.MachineName, Agent.OS, Agent.OSArchitecture, Agent.JobName, provide details about the agent running the build or release pipeline, such as the machine name, operating system, OS architecture, and the job name.

  3. System Variables: These include System.TeamProject, System.TeamFoundationCollectionUri, System.PullRequest.PullRequestId, etc., and provide information about the team project, the Azure DevOps server or Team Foundation Server collection URI, and pull request details if the pipeline is triggered by a pull request.

  4. Pipeline Variables: Pipeline.Workspace is an example of a pipeline variable that provides the local path on the agent where your source code files are downloaded.

  5. Release Variables: In the case of release pipelines, you have variables like Release.ReleaseId, Release.ReleaseName, Release.EnvironmentName, etc., giving information about the release ID, release name, and the environment name.

  6. Repository Variables: These include Build.Repository.Provider, Build.Repository.URI, Build.SourceBranch, Build.SourceVersion, etc., and provide details about the source repository, such as the provider (e.g., GitHub, Azure Repos), the URI of the repository, the source branch for the build, and the latest commit ID or version.

  7. Variable Groups: While not predefined, Variable Groups are a key feature in Azure Pipelines that allow you to store values that are used across multiple pipelines. These can be linked to the pipeline and used just like predefined variables.

  8. Conditional Insertion: Some variables allow you to conditionally control the flow of your pipeline, such as Build.Reason, which indicates why the build was triggered (e.g., manual, scheduled, or triggered by a Git push).

  9. Environment Variables: Azure Pipelines also exposes certain standard environment variables that are common in most CI/CD tools, such as PATH, HOME, etc.

  10. Custom Variables: In addition to predefined variables, you can define your own custom variables at various scopes (pipeline, stage, job, etc.) as per your requirement.

To use these variables in your YAML pipeline, you generally refer to them by wrapping in $() for Windows or ${} for Linux and macOS. For example, $(Build.BuildId) would be used to reference the build ID in a task.

Azure DevOps documentation provides a comprehensive list of these variables, along with detailed descriptions and usage guidelines. It’s crucial to familiarize yourself with these variables to effectively utilize Azure Pipelines and implement sophisticated CI/CD workflows.

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 *