我使用PowerShell从Jenkins作业部署。这项工作将是成功的,并且在集群上开始部署,但有时会失败并回滚,在这种情况下,我不会收到通知。
有没有办法使用powershell cmdlet来监视jenkins作业的升级,以轮询状态或以某种方式知道它是否成功完成或失败?
答案 0 :(得分:0)
不知道是否有更聪明的方法,但您可以使用" Get-ServiceFabricApplicationUpgrade"来获取给定应用程序的升级状态。小命令。
Get-ServiceFabricApplicationUpgrade -ApplicationName fabric:/your/awesomeApp
纯粹巧合我刚刚在我们的集群上运行升级,你得到并输出如下(我调整了一些名称参数等):
ApplicationName : fabric:/your/awesomeApp
ApplicationTypeName : YourAwesomeApp.FabricType
TargetApplicationTypeVersion : 2017.1005.2-r20.1
ApplicationParameters : { "Param1" = "Value1";
"Param2" = "Value2";
"ActorService_MinReplicaSetSize" = "2";
"ActorService_PartitionCount" = "1";
"ActorService_TargetReplicaSetSize" = "3";
}
StartTimestampUtc : 05.10.2017 08.49.39
UpgradeState : RollingForwardInProgress
UpgradeDuration : 00:09:01
CurrentUpgradeDomainDuration : 00:00:00
NextUpgradeDomain : 4
UpgradeDomainsStatus : { "3" = "InProgress";
"0" = "Completed";
"1" = "Completed";
"2" = "Completed";
"4" = "Pending" }
UpgradeKind : Rolling
RollingUpgradeMode : Monitored
FailureAction : Rollback
ForceRestart : False
UpgradeReplicaSetCheckTimeout : 49710.06:28:15
HealthCheckWaitDuration : 00:00:00
HealthCheckStableDuration : 00:02:00
HealthCheckRetryTimeout : 00:10:00
UpgradeDomainTimeout : 00:30:00
UpgradeTimeout : 01:00:00
ConsiderWarningAsError :
MaxPercentUnhealthyPartitionsPerService :
MaxPercentUnhealthyReplicasPerPartition :
MaxPercentUnhealthyServices :
MaxPercentUnhealthyDeployedApplications :
ServiceTypeHealthPolicyMap :
这也会报告它是否处于回滚状态。
可能有趣的是弄清楚你是否可以从Health Monitoring获得回调/事件或其他内容,因为这基本上是导致升级回滚的原因。