Chris Miller
Chris Miller

Reputation: 4899

Is there a way to clone or copy an existing Ci/CD pipeline in Azure DevOps

I have a couple of CI pipelines that I'm using in Azure DevOps to build some Xamarin apps and I want to create a new one that merges the functionality of the two existing ones. Is there a way to copy or clone an existing pipeline so that I can make changes to the new pipeline without impacting the existing pipelines?

I saw that I can export a pipeline to a JSON file and then import it back in. All of the id values in the JSON file are GUID. Will the import process create new GUIDs or will importing the JSON file overwrite the existing pipeline.

Upvotes: 51

Views: 43555

Answers (7)

Sharon Watinsan
Sharon Watinsan

Reputation: 9850

Update: As per Microsoft 07-05-2022

For YAML: Go to pipeline details for your pipeline, and choose Edit. Copy the pipeline YAML from the editor, and paste it into the YAML editor for your new pipeline. enter image description here

For Classic:

Navigate to the pipeline details page for your pipeline. select Clone.

enter image description here

Upvotes: 4

Markus  Szumovski
Markus Szumovski

Reputation: 124

So since Microsoft decided in all its wisdom to remove the "Clone" option from Yaml pipelines (because it would confuse users) I've decided to write a new extension with which you can clone Yaml pipeline definitions again. This might be needed since you can still use variables and triggers in the pipeline definition instead of the yaml file and we're using a lot of those for example. So to save you the hassle of having to rewrite everything manually, here's the Copy Pipeline Azure DevOps extension for Azure DevOps Server 2020+ or Azure DevOps Cloud:

https://marketplace.visualstudio.com/items?itemName=tun.ClonePipeline

have fun...

Upvotes: 2

TrevorBrooks
TrevorBrooks

Reputation: 3840

Click on Pipelines -> Click on your Pipeline -> then click the ellipse in the upper right corner (three vertical dots) then click Clone.

Where to find the Clone option on a build

Upvotes: 41

Vijay Hugar
Vijay Hugar

Reputation: 51

If you want to use existing stage in another pipeline, do following.

  1. Open the stage 2.Click on three dots at right side of it and select 'Save as template'. 3.In another pipeline, while adding stage, just search with name given at step2.

Upvotes: 0

Indrajeet Gour
Indrajeet Gour

Reputation: 4500

I know it is too late but easy way around by official document.

Hope that would help some.

Upvotes: 2

Nick Schroeder
Nick Schroeder

Reputation: 1462

UPDATE February 11th, 2020

Not sure if this is a super-recent change, but you can now again easily clone an existing pipeline. From Pipelines, click on the pipeline you want to clone. On the page where the build history is shown, Clone has been moved to the ellipsis menu on this page.

enter image description here

Upvotes: 59

Losó Adam
Losó Adam

Reputation: 548

UPDATE Feb 2020

Clone is not available anymore. However you can create a new pipeline based on an existing yaml file which is basically cloning.

Pipelines -> New Pipeline -> Configure (3rd page of the wizard) -> Select "Existing Azure Pipelines YAML file"

There you can select the branch and the file you want to use.

Upvotes: 22

Related Questions