Skip to content

Latest commit

 

History

History
193 lines (100 loc) · 7.65 KB

clone-import-pipeline.md

File metadata and controls

193 lines (100 loc) · 7.65 KB
title description ms.topic ms.date monikerRange
Clone or import a pipeline
Create a pipeline by cloning or importing an existing pipeline
conceptual
11/01/2023
<= azure-devops

Clone or import a pipeline

[!INCLUDE version-lt-eq-azure-devops]

One approach to creating a pipeline is to copy an existing pipeline and use it as a starting point. For YAML pipelines, the process is as easy as copying the YAML from one pipeline to another. For pipelines created in the classic editor, the procedure depends on whether the pipeline to copy is in the same project as the new pipeline. If the pipeline to copy is in the same project, you can clone it, and if it is in a different project you can export it from that project and import it into your project.

:::moniker range="azure-devops"

For information in migrating a classic build pipeline to YAML using Export to YAML, see Migrate from classic pipelines.

:::moniker-end

Clone a pipeline

:::moniker range=">= azure-devops-2019"

For YAML pipelines, the process for cloning is to copy the YAML from the source pipeline and use it as the basis for the new pipeline.

:::moniker-end

:::moniker range="azure-devops-2019"

  1. Navigate to your pipeline, and choose Edit.

    :::image type="content" source="media/pipeline-details-2019.png" alt-text="Pipeline details in Azure DevOps Server 2019":::

  2. Copy the pipeline YAML from the editor, and paste it into the YAML editor for your new pipeline.

  3. To customize your newly cloned pipeline, see Customize your pipeline.

:::moniker-end

:::moniker range="> azure-devops-2019"

  1. Go to the pipeline details for your pipeline, and choose Edit.

    :::image type="content" source="media/pipeline-edit.png" alt-text="Edit pipeline.":::

  2. Copy the pipeline YAML from the editor, and paste it into the YAML editor for your new pipeline.

  3. To customize your newly cloned pipeline, see Customize your pipeline.

:::moniker-end

If your new pipeline can be created by copying another classic pipeline in the same project, follow the instructions in this section. If your pipeline is in another project, you can use import/export to copy the pipeline.

You need Edit release pipeline or Edit build pipeline permissions to clone a Classic pipeline.

:::moniker range=">= azure-devops-2019"

  1. Navigate to the pipeline details page for your pipeline.

  2. Choose ... and select Clone.

    Clone pipeline menu

  3. Your pipeline is cloned with -clone appended to the name. Choose Save or Save & queue to save the cloned pipeline.

Note

The Clone entry is only present on the context menu if your pipeline was created in the classic editor.

:::moniker-end


Export and Import a pipeline

You can create a new classic pipeline by exporting an existing one and then importing it. This is useful in cases where the new pipeline has to be created in a separate project.

:::moniker range=">= azure-devops-2019"

In a YAML pipeline, exporting from one project and importing into another is the same process as cloning. You can simply copy the pipeline YAML from the editor and paste it into the YAML editor for your new pipeline.

:::moniker-end

:::moniker range="azure-devops-2019"

  1. Navigate to your pipeline, and choose Edit.

    :::image type="content" source="media/pipeline-details-2019.png" alt-text="Pipeline details in Azure DevOps Server 2019":::

  2. Copy the pipeline YAML from the editor, and paste it into the YAML editor for your new pipeline.

  3. To customize your newly cloned pipeline, see Customize your pipeline.

:::moniker-end

:::moniker range="> azure-devops-2019"

  1. Go to the pipeline details for your pipeline, and choose Edit.

    :::image type="content" source="media/pipeline-edit.png" alt-text="Edit pipeline.":::

  2. Copy the pipeline YAML from the editor, and paste it into the YAML editor for your new pipeline.

  3. To customize your newly cloned pipeline, see Customize your pipeline.

:::moniker-end

To copy a build definition from another project, you can export an existing definition from that project, and then import it.

:::moniker range="azure-devops"

Build pipeline

  1. Navigate to the pipeline details page for your pipeline.

  2. Choose ... and select Export to JSON.

    [!div class="mx-imgBorder"] Export build pipeline

  3. When prompted, save the JSON file on your local machine. The browser will save the file in the download directory as per your browser settings.

  4. To import the pipeline, navigate to the Pipelines page in your project. Choose ..., select Import a pipeline, and select the corresponding import pipeline option.

  5. You will now be prompted to select a JSON file to import its contents. Browse to and select the JSON file that you previously exported.

  6. After import is complete, you will be shown the new pipeline that is created. Note that exporting a pipeline strips any project specific data like agent pools, service connections etc. You will have to once again provide these details.

Note

The Export item is only present on the context menu if your pipeline was created in the classic editor.

Release pipeline

The procedure for exporting and importing a classic release pipeline is very similar to the classic build pipeline procedure, but the menus and UI are slightly different.

  1. To export a classic release pipeline, navigate to Releases, choose ..., and select Export.

    [!div class="mx-imgBorder"] Export release pipeline

  2. To import a classic release pipeline, navigate to Releases, choose +New, and select Import release pipeline.

    [!div class="mx-imgBorder"] Import release pipeline

:::moniker-end

:::moniker range=">= azure-devops-2019 <= azure-devops-2020"

  1. Navigate to the pipeline details page for your pipeline.

  2. Choose ... and select Export.

    [!div class="mx-imgBorder"] Export pipeline menu

  3. When prompted, save the JSON file on your local machine. The browser will save the file in the download directory as per your browser settings.

  4. To import the pipeline, navigate to the Builds or Releases page in your project. Choose +New and select the corresponding import pipeline option.

    [!div class="mx-imgBorder"] Import pipeline menu

  5. You will now be prompted to select a JSON file to import its contents. Browse to and select the JSON file that you previously exported.

  6. After import is complete, you will be shown the new pipeline that is created. Note that exporting a pipeline strips any project specific data like agent pools, service connections etc. You will have to once again provide these details.

Note

The Export item is only present on the context menu if your pipeline was created in the classic editor.

:::moniker-end


Next steps

Learn to customize the pipeline you just cloned or imported.