【问题标题】:Unabled to deploy service fabric application to azure remote cluster from VSTS continuous inrgration无法将服务结构应用程序部署到 VSTS 持续集成的 Azure 远程集群
【发布时间】: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


【解决方案1】:

在您的发布配置文件http://s30.postimg.org/bttleqitd/cloud.jpg 中,您使用StoreLocation="CurrentUser",但如果您遵循https://azure.microsoft.com/en-us/documentation/articles/service-fabric-set-up-continuous-integration,特别是设置您的构建机器下的导入您的自动化证书部分那么您可能已经将您的证书导入到LocalMachine 存储位置。

只需将您的发布配置文件中的 StoreLocationCurrentUser 更改为 LocalMachine 即可。

【讨论】:

  • 正是这个原因。非常感谢:)
【解决方案2】:

点源符号表示使用 . “xxx.ps1”。详情参考此链接:PowerShell – What is dot sourcing and why use it?

【讨论】:

  • 我已经尝试过这样的事情。对 PowerShell 任务使用内联脚本并使用以下 powershell 命令。 . ./Deploy-FabricApplication.ps1 -ApplicationPackagePath 'C:\agent_work\1\s\TestApp\pkg\Release' -PublishProfileFile 'C:\agent_work\1\s\TestApp\PublishProfiles\Cloud.xml' -DeployOnly:$false -UnregisterUnusedApplicationVersionsAfterUpgrade $false -OverrideUpgradeBehavior '无' -OverwriteBehavior 'SameAppTypeAndVersion' -ErrorAction 停止;工作目录设置为脚本目录。还没有运气!
  • @user1814131 尝试以下格式:(.'./Deploy-FabricApplication.ps1')。 () 之间的事情。
  • 不走运...从事件查看器我收到以下错误:传输 0x17FA9CEFF0:未能将安全设置设置为 { provider=SSL protection=EncryptAndSign store='CurrentUser/My' findValue='FindByThumbprint :9c3b3216282cf97d22c9f0518d268ee408a06e31' remoteCertThumbprints='9c3b3216282cf97d22c9f0518d268ee408a06e31' clientRoleEnabled=false claimBasedClientAuthEnabled=false }: CertificateNotFound
  • 这是 VSTS 构建中的错误日志: Connect-ServiceFabricCluster :此操作期间发生错误。请检查跟踪日志以获取更多详细信息。在 C:\agent_work\2\s\TestApp\Scripts\Deploy-FabricApplication.ps1:172 char:16 + [void](Connect-ServiceFabricCluster @ClusterConnectionParameters)
  • 另一部分错误:+ CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException + FullyQualifiedErrorId : CreateClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster Test-ServiceFabricClusterConnection : 集群连接实例为空
猜你喜欢
  • 2017-11-08
  • 2017-11-07
  • 1970-01-01
  • 1970-01-01
  • 2018-11-16
  • 2021-10-13
  • 2019-04-17
  • 2020-10-19
  • 2019-08-09
相关资源
最近更新 更多