【发布时间】:2016-07-30 21:41:54
【问题描述】:
我已根据以下文档在 Visual Studio Team Services 中为 Service Fabric 应用程序配置 CI 构建:https://azure.microsoft.com/en-us/documentation/articles/service-fabric-set-up-continuous-integration。
但是,我已经更改了上述文档中指定的部署部分。因为我想部署在我之前创建的远程天蓝色集群上,所以我调用 使用 power shell 部署具有所需参数的 Deploy-FabricApplication.ps1。但不幸的是,这不起作用。我收到以下错误:
[void](Connect-ServiceFabricCluster @ClusterConnectionParameters) InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException FullyQualifiedErrorId : CreateClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster
警告:无法验证与 Service Fabric 群集的连接。
[错误]Test-ServiceFabricClusterConnection : 集群连接实例为空 [错误]在 C:\Program Files\Microsoft SDKs\Service [错误]Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:119 char:16 空白 : ResourceUnavailable: (:) [Test-ServiceFabricClusterConnection], NullReferenceException FullyQualifiedErrorId : GetClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.TestClusterConnection
我可以使用 Visual Studio 成功部署。即使我使用 power shell 从构建机器运行 Deploy-FabricApplication.ps1,应用程序也会被部署而没有任何错误。但只有当我使用 VSTS 构建步骤(CI 的一部分)运行它时,才会出现上述错误。
请注意,根据 Charisk 在另一个 stackoverflow 线程上的建议,我已修改 Deploy-FabricApplication.ps1 文件,将以下行放在第 169 行之后。 $global:clusterConnection = $clusterConnection
这也无济于事。提前感谢您的帮助。
【问题讨论】:
-
您使用哪个任务来运行 power-shell 脚本? Powershell 还是 Azure Powershell?您是否尝试过该线程中的解决方案:使用“纯”powershell 构建任务确保脚本是使用 . (点)符号就像一个魅力。?
-
我正在使用 Powershell
-
我认为问题在于 . (点)符号。我刚刚在 vsts 构建任务中指定了默认 Deploy-FabricApplication.ps1 的路径。我还传递了一些参数。如何确保脚本将使用点表示法执行?我相信在我的场景中调用是这种情况,而不是点源。
标签: azure visual-studio-2012 azure-devops azure-service-fabric azure-pipelines-build-task