无法在 DevOps 上并行执行 Powershell 7 脚本 [英] Not able to execute Powershell 7 scripts parallelly on DevOps

查看:48
本文介绍了无法在 DevOps 上并行执行 Powershell 7 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为发布部署的一部分,我们在发布管道中使用 Azure Powershell 步骤来使用 DACPAC 更新我们的数据库.这当前遍历这些数据库中的每一个并按顺序更新它们.每个数据库大约需要 35 到 40 秒,此过程中的这一步需要将近一个小时(大约 100 dbs),并且随着客户和数据库的增长而继续增长.

As part of our release deployment, we use an Azure Powershell step in our Release Pipeline to use DACPAC to update our databases. This currently iterates through each of these databases and updates them sequentially. At approximately 35 – 40 seconds per database, this step in the process is taking almost an hour (around 100 dbs) and will continue to grow as customers grows and so databases.

我一直在研究并发现 Powershell 7 现在支持并行执行.但是,Azure DevOps 并未正式支持此操作.然而,在我的研究中,我发现行业中的一些用户以某种方式在他们的部署中运行 Powershell 7.

I have been researching and have found that Powershell 7 now supports parallel execution. However, Azure DevOps does not officially support this. In my research, however, I am finding that some users out in the industry are somehow running Powershell 7 in their deployments.

有什么办法,我们可以如何在 DevOps 上实现 Powerlshell 7 脚本的并行执行?

Is there any way, how we can achieve parallel execution of Powerlshell 7 scripts on DevOps?

推荐答案

要在 DevOps 上运行 Powershell 7 脚本,您需要明确选择在 Azure DevOps 中使用 Powershell 核心 (v 7.0.3) 的选项.从 Powershell 6 开始,它现在被称为 Powershell 核心并作为 pwsh.exe 启动.PowerShell Core 与 Windows PowerShell 并行运行,默认情况下,当您在 Azure DevOps 上使用 Powershell 任务时,它使用普通的 powershell(即 v 5.1).所以,在没有这个 Powershell 的情况下运行时,默认为没有这个功能的普通 powershell.exe.

To run the Powershell 7 script on DevOps, you need to explicitly select the option to use Powershell core (v 7.0.3) in Azure DevOps. Powershell 6 onwards it is now known as Powershell core and is launched as pwsh.exe. PowerShell Core runs side-by-side with Windows PowerShell and by default when you are using the Powershell task on Azure DevOps it uses normal powershell (i.e. v 5.1). So, when running without this Powershell default to the normal powershell.exe which does not have this feature.

我们可以使用任务的高级设置下的复选框使用 Powershell Core 并使用并行功能,在 Azure DevOps 任务上启用 Powershell 核心.

We can enable Powershell core on Azure DevOps task using the checkbox Use Powershell Core under Advanced settings of the task and use the parallel feature.

这篇关于无法在 DevOps 上并行执行 Powershell 7 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆