简体   繁体   English

Azure DevOps - 清理本地服务器上的旧版本?

[英]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.

相关问题 从 Azure DevOps 访问本地 Bitbucket 服务器 - Access a on-premise Bitbucket Server from Azure DevOps Azure 托管的逻辑应用程序能否连接到本地 Azure DevOps Server(以前称为 Team Foundation Server) - Can an Azure hosted Logic App connect to an on-premise Azure DevOps Server (formerly known as Team Foundation Server) 如何将 azure-devops 命令添加到离线本地服务器中的 Azure CLI? - How do I add the azure-devops commands to the Azure CLI in an offline on-premise server? 在(本地 linux 代理)mysql 服务器上执行 mysql 脚本任务? - Executing mysql scripts tasks on (on-premise linux agent) mysql server using Azure DevOps Release pipeline? 本地 SQL 服务器到 Azure PostgreSQL 复制 - On-premise SQL Server to Azure PostgreSQL replication Azure AD 到本地非 AD 服务器 - Azure AD to On-premise non AD Server 是否可以将团队项目及其工作项从VSTS(Azure DevOps)实例导出到本地TFS 2018 Server实例? - Is there a way to export Team Projects and their Work Items from a VSTS (Azure DevOps) instance to an On-premise TFS 2018 Server instance? 具有本地SQL Server和最佳实践的Azure搜索数据源? - Azure Search DataSource with on-premise SQL Server and best practices? 如何将 map 本地服务器内核转换为 Azure Sql 数据库的 vcore? - How to map on-premise server cores to vcores for Azure Sql Database? 如何从 Azure Powershell 运行手册连接到本地 SQL 服务器? - How to connect to an on-premise SQL Server from Azure Powershell runbook?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM