|
1 | 1 | --- |
2 | | -title: Migrate from Classic to YAML pipelines |
| 2 | +title: Migrate your Classic pipeline to YAML |
3 | 3 | titleSuffix: Azure Pipelines |
4 | | -description: How to migrate from Classic pipelines to YAML. |
| 4 | +description: Learn how to migrate from Classic pipelines to YAML. |
5 | 5 | ms.subservice: azure-devops-pipelines-migrate |
6 | 6 | ms.topic: quickstart |
7 | | -ms.date: 07/01/2024 |
| 7 | +ms.date: 06/26/2025 |
8 | 8 | monikerRange: azure-devops |
9 | 9 | --- |
10 | 10 |
|
11 | 11 | # Migrate your Classic pipeline to YAML |
12 | 12 |
|
13 | 13 | [!INCLUDE [version-eq-azure-devops](../../includes/version-eq-azure-devops.md)] |
14 | 14 |
|
15 | | -Get started with Azure Pipelines by converting your existing Classic pipeline to use YAML. With a YAML-based pipeline, you can implement your CI/CD strategy as code and see its history, compare versions, blame, annotate, and so on. |
| 15 | +Azure Pipelines lets you manage your CI/CD process as code, making it easier to track changes, compare versions, annotate, and more. |
16 | 16 |
|
17 | | -When you convert your Classic pipeline, the end product is two pipelines. You'll have one new YAML pipeline and a Classic pipeline that can be retired. Your Classic pipeline's run history remains in the Classic pipeline. |
| 17 | +When you convert a Classic pipeline, you’ll end up with two pipelines: a new YAML pipeline and the original Classic one, which can then be retired. Your Classic pipeline's run history remains in the Classic pipeline. |
18 | 18 |
|
19 | 19 | > [!NOTE] |
20 | | -> You can only export a YAML file from an existing Classic pipeline created with the classic build designer. If you don't see the option to export to JSON or YAML, then your pipeline doesn't support exporting. Classic release pipelines don't have the export to YAML option. You can export a classic release pipeline by exporting each individual task. |
| 20 | +> You can only export a YAML file from a Classic pipeline created using the classic build designer. If you don’t see an option to export to YAML or JSON, your pipeline likely doesn’t support exporting. Classic release pipelines don’t support YAML export, you’ll need to export each task individually. |
21 | 21 |
|
22 | 22 | ## Prerequisites |
23 | 23 |
|
24 | | -Make sure you have the following items before you begin. |
25 | | - |
26 | | -- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
27 | | -- An active Azure DevOps organization. [Sign up for Azure Pipelines](../get-started/pipelines-sign-up.md). |
28 | | -- A working pipeline that uses the Classic user interface (UI) editor. |
29 | | -- A sample YAML pipeline file in your code. Create a sample YAML pipeline in the following section. |
| 24 | +| **Product** | **Requirements** | |
| 25 | +|--------------------|--------------------| |
| 26 | +| **Azure** | - An Azure account with an active [subscription](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). | |
| 27 | +| **Azure DevOps** | - An Azure DevOps [organization](../../organizations/accounts/create-organization.md).<br>- An Azure DevOps [project](../../organizations/projects/create-project.md).<br> - Allow [Azure Artifacts Domain URLs and IP addresses](../../organizations/security/allow-list-ip-url.md) if your organization is using a firewall or a proxy server.<br> - A working Classic pipeline. | |
30 | 28 |
|
31 | 29 | ## Create a sample YAML pipeline |
32 | 30 |
|
33 | | -Do the following steps to create a sample YAML pipeline, which you'll update later with your exported code from the Classic UI editor. |
34 | | - |
35 | | -1. Sign in to your organization (```https://dev.azure.com/{yourorganization}```) and select your project. |
36 | | - |
37 | | -2. Select **Pipelines**, and then **New pipeline**. |
38 | | - |
39 | | - :::image type="content" source="media/pipelines-new-pipeline.png" alt-text="Two buttons to select for new pipeline creation."::: |
| 31 | +Follow these steps to create a starter YAML pipeline, which you’ll later update with code exported from the Classic UI editor: |
40 | 32 |
|
41 | | -3. Select the location for your source code as either **GitHub** or **Azure Repos Git**. |
| 33 | +1. Sign in to your organization, and navigate to your project. |
42 | 34 |
|
43 | | - :::image type="content" source="media/source-code-location.png" alt-text="List of possible selections for your source code."::: |
| 35 | +1. Select **Pipelines**, and then select **New pipeline**. |
44 | 36 |
|
45 | | -4. Select a repository. |
| 37 | + :::image type="content" source="media/pipelines-new-pipeline.png" alt-text="A screenshot displaying how to create a new pipeline."::: |
46 | 38 |
|
47 | | - :::image type="content" source="media/select-repository.png" alt-text="Page where you select a repository for your source code pipeline."::: |
| 39 | +1. Select your source code location either **GitHub** or **Azure Repos Git**, and then select your repository. |
48 | 40 |
|
49 | | -5. On the Configure your pipeline page, select **Starter pipeline**. |
| 41 | + :::image type="content" source="media/source-code-location.png" alt-text="A screenshot displaying source code locations."::: |
50 | 42 |
|
51 | | - :::image type="content" source="media/select-pipeline-template.png" alt-text="List of templates to choose from for configuring your new pipeline."::: |
| 43 | +1. On the **Configure your pipeline page**, select the **Starter pipeline**. |
52 | 44 |
|
53 | | -6. Select **Save and run**. |
| 45 | + :::image type="content" source="media/select-pipeline-template.png" alt-text="A screenshot displaying the available pipeline templates."::: |
54 | 46 |
|
55 | | - :::image type="content" source="media/save-run-new-yaml-pipeline.png" alt-text="Review page where you select Save and run."::: |
| 47 | +1. Select **Save and run**, and then enter your commit message. Select **Commit directly to the main branch**, and then select **Save and run** once more. This will start a new run and commit the yaml pipeline to your repository. |
56 | 48 |
|
57 | | -7. Enter your commit message, select **Commit directly to the main branch**, and then choose **Save and run** again. A new run starts and it's committed to the repository. Wait for the run to finish. |
| 49 | + :::image type="content" source="media/commit-save-run.png" alt-text="A screenshot displaying how to save and run a new yaml pipeline."::: |
58 | 50 |
|
59 | | - :::image type="content" source="media/commit-save-run.png" alt-text="Commit message to commit to the main branch, and then select Save and run button."::: |
| 51 | +## Export a Classic pipeline to YAML |
60 | 52 |
|
61 | | -## Export your Classic pipeline |
62 | | - |
63 | | -1. Sign in to your Azure DevOps organization, and then go to your project. |
| 53 | +1. Sign in to your Azure DevOps organization, and navigate to your project. |
64 | 54 |
|
65 | 55 | 1. Select **Pipelines** > **Pipelines**. |
66 | 56 |
|
67 | | -1. Select your Classic pipeline definition, select the ellipses icon, and then select **Export to YAML**. Make sure you're in the pipeline definition view, not a specific run, to see the **Export to YAML** option. |
| 57 | +1. Find your Classic pipeline, select the ellipses (...) next to it, and then select **Export to YAML**. Make sure you're in the pipeline definition view, not a specific run, to see the **Export to YAML** option. |
68 | 58 |
|
69 | | - :::image type="content" source="media/export-yaml.png" alt-text="Screenshot of context menu, to export your pipeline to YAML."::: |
| 59 | + :::image type="content" source="media/export-yaml.png" alt-text="A screenshot displaying how to export a Classic pipeline to YAML."::: |
70 | 60 |
|
71 | 61 | 1. Open the downloaded YAML file in your code editor. |
72 | 62 |
|
73 | | -1. If your YAML pipeline includes variables defined in the Classic UI, define the variables again in your pipeline settings UI or in your YAML file. For more information, see [Define variables](../process/variables.md). |
74 | | - |
75 | | -1. Review any `cron` schedules in your YAML file. By default, `cron` schedules in YAML are in UTC. In Classic pipelines, they are in the organization's timezone. For more information, see [Configure schedules for pipelines](../process/scheduled-triggers.md). |
76 | | - |
77 | | -1. Use the Task Assistant to make any other changes to the YAML file. The Task Assistant is a pane on the right side of the screen, which helps you correctly create and modify YAML steps. |
78 | | - |
79 | | - :::image type="content" source="media/task-assistant-yaml.png" alt-text="Configure your pipeline task with Task Assistant."::: |
| 63 | +1. If your Classic pipeline used variables defined in the Classic UI editor, you’ll need to redefine them either in the YAML file or in the pipeline settings. See [Define variables](../process/variables.md) for more details. |
80 | 64 |
|
81 | | -1. **Save and run** your pipeline. |
| 65 | +1. Review any `cron` schedules in your YAML file. YAML schedules use UTC by default, while Classic pipelines use your organization’s local time zone. See [Configure schedules for pipelines](../process/scheduled-triggers.md) for more details. |
82 | 66 |
|
83 | | -## Clean up resources |
| 67 | +1. Use the **Task Assistant** (the pane on the right side of the editor) to help you add or modify steps in your YAML file. |
84 | 68 |
|
85 | | -If you're not going to use this sample pipeline anymore, delete it from your project. Deletion is permanent and includes all builds and associated artifacts. |
| 69 | + :::image type="content" source="media/task-assistant-yaml.png" alt-text="A screenshot displaying how to configure pipeline tasks with the Task Assistant."::: |
86 | 70 |
|
87 | | -1. Select the ellipses (...) and select **Delete**. |
| 71 | +1. Select **Save and run** once you're done. |
88 | 72 |
|
89 | | -2. Enter the name of your pipeline to permanently delete it, and then select **Delete**. |
| 73 | +## Related content |
90 | 74 |
|
91 | | -## FAQ |
92 | | - |
93 | | -### Is there a task in YAML pipelines to create work items when there's a build failure? |
94 | | - |
95 | | -YAML pipelines don't have a [Create work item on failure setting](../build/options.md#create-a-work-item-on-failure) like classic build pipelines. You have a couple of options for creating this functionality yourself. |
96 | | -- You can use a script or PowerShell task and call the [REST API](/rest/api/azure/devops/pipelines/). |
97 | | -- You can use Azure CLI to call [az boards work-item create](/cli/azure/boards/work-item#az-boards-work-item-create) in your pipeline. [See an example](../customize-pipeline.md#create-work-item-on-failure) of using the CLI to create a bug on failure. |
98 | | - |
99 | | -## Next steps |
100 | | - |
101 | | -Learn about the feature differences between YAML and Classic pipelines. |
102 | | - |
103 | | -> [!div class="nextstepaction"] |
104 | | -> [Use Azure Pipelines](../get-started/pipelines-get-started.md#feature-availability) |
105 | | -
|
106 | | -## Related articles |
| 75 | +- [YAML vs Classic Pipelines](../get-started/pipelines-get-started.md#feature-availability) |
107 | 76 |
|
108 | 77 | - [Customize your pipeline](../customize-pipeline.md) |
109 | | -- [Learn YAML pipeline editor basics](../get-started/yaml-pipeline-editor.md) |
110 | | -- [Define approvals and checks](../release/approvals/approvals.md) |
| 78 | + |
| 79 | +- [YAML pipeline editor](../get-started/yaml-pipeline-editor.md) |
0 commit comments