[英]Azure DevOps - Clean up old releases on on-premise server?
I have a pipeline that deploys code to an IIS folder on an on-premise server.我有一个管道将代码部署到本地服务器上的 IIS 文件夹。 I'm trying to figure out how to best delete old release folders.
我想弄清楚如何最好地删除旧的发布文件夹。 I'm not seeing anything obvious within DevOps.
我在 DevOps 中没有看到任何明显的东西。
Is there a native way of doing this?有这样做的本地方式吗? Or should I roll my own PowerShell script to delete old releases?
还是我应该使用自己的 PowerShell 脚本来删除旧版本?
Is there a native way of doing this?
有这样做的本地方式吗?
Yes, of course there is.是的,当然有。
Open your deploy task, go Advanced Deployment Options and then enable the option Remove Additional Files at Destination打开您的部署任务,转到高级部署选项,然后启用在目标位置删除其他文件选项
Noted : This "delete" operation I mentioned is not mean that clear all the files in local IIS folder.注意:我提到的这个“删除”操作并不意味着清除本地 IIS 文件夹中的所有文件。 It just delete the files at the destination where there's no corresponding file in the package which is being deployed.
它只是删除正在部署的包中没有相应文件的目的地的文件。
In one word, for some files which same with previous, it will be override as the latest files.一句话,对于一些与之前相同的文件,它将被覆盖为最新的文件。 And, for any left over files from a previous deployment that are no longer required , they will be deleted .
并且,对于以前部署中不再需要的任何剩余文件,它们将被删除。
If you do not trust this option and want to clear the previous files completely , you can also add the Powershell task before IIS manage task and run delete script.如果您不信任此选项并想彻底清除以前的文件,您还可以在IIS 管理任务之前添加Powershell任务并运行删除脚本。
Here is the sample script to delete local files:这是删除本地文件的示例脚本:
Remove-Item -Path "D:\Websites2\*"
You can replace "D:\\Websites2\\*"
as your local website file path.您可以将
"D:\\Websites2\\*"
替换为您的本地网站文件路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.