Understanding the Classic Editor for Azure Pipelines
Azure DevOps offers two primary ways to define your build and release pipelines: the YAML editor and the Classic editor. While YAML pipelines are the recommended approach for modern CI/CD practices due to their code-based nature and version control benefits, the Classic editor remains a valuable tool, especially for those familiar with it or for specific scenarios. This tutorial will guide you through the features and functionalities of the Classic editor.
What is the Classic Editor?
The Classic editor is a graphical user interface (GUI) that allows you to visually design and configure your build and release pipelines. It uses a task-based approach, where you select pre-defined tasks from a catalog and configure their inputs and outputs to orchestrate your CI/CD process.
Key Components of the Classic Editor
When you create or edit a pipeline in the Classic editor, you'll encounter several key areas:
1. Pipeline Designer Canvas
This is the main workspace where you assemble your pipeline. It consists of agents, stages, jobs, and tasks. You drag and drop tasks or select them from the available list to build your workflow.
2. Task Catalog
A comprehensive list of available tasks for building, testing, deploying, and managing your code. Tasks are categorized by source control, build, test, deploy, package, and utility.
3. Task Configuration Pane
When you select a task on the canvas, this pane appears, allowing you to configure its specific settings, such as script paths, arguments, service connections, and variables.
4. Variables
Define and manage variables that can be used throughout your pipeline to parameterize tasks and configurations. This is crucial for making your pipelines reusable and adaptable.
# Example of how variables might be used
- task: AzureWebApp@1
inputs:
azureSubscription: $(azureServiceConnection)
appName: $(webAppName)
package: '$(Pipeline.Workspace)/drop/**/*.zip'
5. Triggers
Configure what initiates your pipeline, such as code commits to specific branches (CI triggers) or scheduled runs.
6. Options
Control pipeline behavior, including agent pools, build retention policies, and artifact management.
Creating a Build Pipeline with the Classic Editor
Let's walk through a simple example of creating a build pipeline:
- Navigate to your Azure DevOps project and select "Pipelines" > "Pipelines".
- Click "New pipeline".
- Select "Use the classic editor" at the bottom of the page.
- Choose your repository and branch.
- Select a starter pipeline template or choose "Empty job".
- In the "Agent job" section, select an appropriate agent pool.
- Click the "+" button on the Agent job to add tasks.
- Search for and add tasks like "Checkout Sources", "Build solution", "Publish build artifacts", etc.
- Configure each task's inputs and outputs.
- Save and queue your pipeline.
Creating a Release Pipeline with the Classic Editor
Release pipelines in the Classic editor are designed to automate the deployment of your built artifacts to various environments.
- Navigate to "Pipelines" > "Releases".
- Click "New pipeline".
- Select a template or choose "Empty job".
- Add an artifact, linking it to your build pipeline's output.
- Define stages (e.g., Development, Staging, Production) and configure them with deployment tasks.
- Tasks within a stage might include "Azure App Service deploy", "Run PowerShell on target machines", etc.
- Configure triggers (e.g., Continuous deployment) and pre-deployment approvals.
- Save and create a release.
When to Use the Classic Editor
- Familiarity: If your team is already comfortable with the GUI approach.
- Visual Inspection: For quickly visualizing and understanding pipeline flows.
- Specific Task Needs: Some older or less common tasks might have better support or be exclusive to the Classic editor.
- Simple Scenarios: For straightforward build or deployment processes that don't require complex conditional logic best expressed in YAML.
Transitioning to YAML
While the Classic editor is functional, Microsoft strongly recommends migrating to YAML pipelines. YAML pipelines offer:
- Version Control: Pipelines as code, stored with your application code.
- Code Review: Ability to review pipeline changes through pull requests.
- Flexibility: More powerful syntax for complex logic and templating.
- Consistency: Easier to maintain consistency across multiple pipelines.
You can often export an existing Classic pipeline as YAML to help with this transition.
By understanding the Classic editor, you can effectively manage and maintain your existing CI/CD infrastructure in Azure DevOps while planning for a potential migration to more modern YAML-based pipelines.