我们正在使用带有vNext发布模板的Release Management 2015。对于我们应用程序的每个部分,我们都有一个基于Powershell DSC的组件部署。事实上,我们有两个不同的应用程序正在部署并进行活动开发,并且通常几乎同时部署。
我们在部署过程中经常会遇到以下错误:
OperationFailedException:由于另一个部署正在进行中,因此不允许新的部署。请稍后重试部署。
完整的堆栈跟踪显示,该错误不是来自Powershell本身,而是来自Release Management系统,该系统负责在目标机器上执行Powershell脚本。
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException: New deployment is not allowed as an another deployment is in progress. Retry the deployment after sometime.
at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.ReadDeploymentResponse(DeploymentResponse response)
at Microsoft.TeamFoundation.Release.EnvironmentProvider.OnPrem.Implementation.OnPremDeploymentProvider.RunScript(String scriptPath, String configurationPath, MachineSpecification machine, StorageSpecification storage, Dictionary`2 configurationVariables)
at Microsoft.TeamFoundation.Release.MonitorServices.Dsc.OnPrem.OnPremDeploymentActions.InvokePlatform(String activityId, MachineSpecification machineSpecification, StorageSpecification storageSpecification, String scriptPath, String configurationPath, Dictionary`2 configurationVariables)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.Dsc.DscComponentInstaller.InvokeMethodByReflection(String methodArguments)
上述错误导致整个部署失败,我们不得不重试阶段或整个部署才能完成。
有两种情况会导致这种情况发生:
- 两个发布模板在同一目标服务器上同时执行其PowerShell脚本
- 单个发布模板具有并行控制流,其中包含两个不同的组件,两者都在同一目标服务器上执行脚本
换句话说,发布管理使用的执行远程服务器上PowerShell脚本的机制似乎只能同时执行单个脚本,并且无法等待/保持其他脚本完成。
如果所涉及的脚本正在主动修改其执行的服务器,那么这种情况有点合理,但在我们的情况下,服务器基本上只是一个运行脚本的暂存区。脚本的“真正”目标与运行PowerShell的服务器无关。
除了每个同时部署的组件都有一个服务器(哇),还有什么解决方法吗?这似乎是一个很大的疏忽,严重地让我考虑完全放弃发布管理。