Reputation: 83
How do i copy files from one azure devops project to another azure devops project using yaml. I have a 2 different project (project_management and usecase_04), I want to copy files from a folder in project_management to usecase_04.
Upvotes: 0
Views: 5173
Reputation: 11
In order to see/use both projects in the agent build you need to checkout both projects first. You can look how to do it in this link: https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops#:~:text=Azure%20Pipelines%20%7c%20Azure%20DevOps%20Server%202020%20Pipelines%2cone%20you%20use%20to%20store%20your%20YAML%20pipeline
or use my example:
steps:
after both projects are available in the agent folder, you can use CopyFiles@2 task, for example:
- task: CopyFiles@2
displayName: [give a name]
inputs:
sourceFolder: '$(path to file you want to copy over from project_management)'
contents: '*'
targetFolder: '$(path to usecase_04)'
overWrite: true # optional
here also the link: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/copy-files?view=azure-devops&tabs=yaml
Upvotes: 1
Reputation:
Copying an existing pipeline and using it as a starting point is one method for developing a pipeline. The procedure is as simple as copying the YAML from one pipeline to another for YAML pipelines. The process varies depending on whether the pipeline to clone is in the same project as the new pipeline for pipelines produced with the old editor.
You can clone a pipeline if it is in the same project, or you can export it from a different project and import it into your project if it is in a different project.
When cloning a YAML pipeline, the YAML from the source pipeline is copied and used as the foundation for the new pipeline.
Click on edit of your pipeline.
The YAML for your new pipeline should have the pipeline YAML copied from the editor and pasted there.
To modify the pipeline you recently cloned, see Customize your pipeline.
By exporting an existing pipeline and importing it again, you can construct a new traditional pipeline. This is helpful when a new pipeline needs to be built as part of a different project.
Exporting from one project and importing it into another is the same as cloning in a YAML pipeline. To use the pipeline YAML in your new pipeline, simply copy it from the editor and paste it there and for this, follow the above 3 points:
Upvotes: -1