简体   繁体   English

在发布管理/管道期间如何在TFS 2015中进行代码备份

[英]How to take code backup in TFS 2015 during Release Management/Pipeline

I've done Build for my code in TFS 2015. Now i'm configuring CD, my tasks would be 我已经在TFS 2015中完成了代码的构建。现在,我正在配置CD,我的任务是

  1. Take Backup of existing release code 备份现有发行代码
  2. Deploy build artifact to my server 将构建工件部署到我的服务器
  3. Rollback task if deployment fails 如果部署失败,将执行回滚任务

I'm struck with Task 1 : Take backup of exiting release code. 我对任务1感到震惊:备份现有的发行代码。

I would prefer using PowerShell task as suggested over here , as my my release server path differs with different an ID {mulitple paths with multiple Id's] 我宁愿按照此处的建议使用PowerShell任务,因为我的发布服务器路径因ID({具有多个ID的多个路径)不同而不同

How to take code backup in TFS 2015 during Release Management/Pipeline 在发布管理/管道期间如何在TFS 2015中进行代码备份

Indeed, Backing up existing release code on the server is really a tricky issue, if your release server path differs with different an ID. 的确,如果发布服务器路径的ID不同,则备份服务器上的现有发布代码确实是一个棘手的问题。 It seems we have to create several task to back up release code from different release server path or we have to write the scripts(PS, Batch) to back up those release code. 似乎我们必须创建几个任务来备份来自不同发布服务器路径的发布代码,或者我们必须编写脚本(PS,批处理)来备份那些发布代码。

To resolve this question, I would like provide a workaround, you can check if it works for you. 为了解决这个问题,我想提供一种解决方法,您可以检查它是否适合您。 The tasks would be: 任务将是:

  1. Deploy build artifact to the server. 将构建工件部署到服务器。
  2. Use Copy task to back up the build artifact to the local folder of the TFS server machine with condition Only when all previous tasks have succeeded . 使用复制任务将构建工件备份到TFS服务器计算机本地文件夹,条件是仅当所有先前的任务都成功时
  3. Deploy backup artifact to the server with condition Only when all previous tasks failed (Also check the option Clear Target Folder under the Advanced tab). 仅在所有先前任务均失败时将备份工件部署到服务器,条件是(也请检查“高级”选项卡下的“ Clear Target Folder ”选项)。

Some explanations for tasks 2 and task 3: 任务2和任务3的一些说明:

Task2: This steps is use to back up the release code of the last successful deployment, and save it to the local folder on the server. 任务2:此步骤用于备份上一次成功部署的发行代码,并将其保存到服务器上的本地文件夹中。

Task3: This steps is used to deploy the back up the release code to overwrite the release code that failed to deploy before, if the previous deployment task failed. 任务3:如果先前的部署任务失败,则此步骤用于部署备份的发布代码以覆盖之前未能部署的发布代码。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM