Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ServiceFabricDeploy] Test application package only if copy and register is going to happen #7524

Merged
merged 5 commits into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,7 @@
throw $errMsg
}

if (!$SkipPackageValidation)
{
$global:operationId = $SF_Operations.TestApplicationPackage
$packageValidationSuccess = (Test-ServiceFabricApplicationPackage $AppPkgPathToUse)
if (!$packageValidationSuccess)
{
$errMsg = (Get-VstsLocString -Key SFSDK_PackageValidationFailed -ArgumentList $ApplicationPackagePath)
throw $errMsg
}
}


$ApplicationManifestPath = "$AppPkgPathToUse\ApplicationManifest.xml"

Expand Down Expand Up @@ -271,6 +262,17 @@
}
if (!$reg -or !$ApplicationTypeAlreadyRegistered)
{
if (!$SkipPackageValidation)
{
$global:operationId = $SF_Operations.TestApplicationPackage
$packageValidationSuccess = (Test-ServiceFabricApplicationPackage $AppPkgPathToUse)
if (!$packageValidationSuccess)
{
$errMsg = (Get-VstsLocString -Key SFSDK_PackageValidationFailed -ArgumentList $ApplicationPackagePath)
throw $errMsg
}
}

Write-Host (Get-VstsLocString -Key SFSDK_CopyingAppToImageStore)
# Get image store connection string
$global:operationId = $SF_Operations.GetClusterManifest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,6 @@ function Publish-UpgradedServiceFabricApplication
return
}

# Get image store connection string
$global:operationId = $SF_Operations.GetClusterManifest
$clusterManifestText = Get-ServiceFabricClusterManifest
$imageStoreConnectionString = Get-ImageStoreConnectionStringFromClusterManifest ([xml] $clusterManifestText)

if (!$SkipPackageValidation)
{
$global:operationId = $SF_Operations.TestApplicationPackage
$packageValidationSuccess = (Test-ServiceFabricApplicationPackage $AppPkgPathToUse -ImageStoreConnectionString $imageStoreConnectionString)
if (!$packageValidationSuccess)
{
$errMsg = (Get-VstsLocString -Key SFSDK_PackageValidationFailed -ArgumentList $ApplicationPackagePath)
throw $errMsg
}
}

try
{
Expand Down Expand Up @@ -250,6 +235,22 @@ function Publish-UpgradedServiceFabricApplication

if (!$reg -or !$ApplicationTypeAlreadyRegistered)
{
# Get image store connection string
$global:operationId = $SF_Operations.GetClusterManifest
$clusterManifestText = Get-ServiceFabricClusterManifest
$imageStoreConnectionString = Get-ImageStoreConnectionStringFromClusterManifest ([xml] $clusterManifestText)

if (!$SkipPackageValidation)
{
$global:operationId = $SF_Operations.TestApplicationPackage
$packageValidationSuccess = (Test-ServiceFabricApplicationPackage $AppPkgPathToUse -ImageStoreConnectionString $imageStoreConnectionString)
if (!$packageValidationSuccess)
{
$errMsg = (Get-VstsLocString -Key SFSDK_PackageValidationFailed -ArgumentList $ApplicationPackagePath)
throw $errMsg
}
}

$applicationPackagePathInImageStore = $names.ApplicationTypeName
Write-Host (Get-VstsLocString -Key SFSDK_CopyingAppToImageStore)

Expand Down Expand Up @@ -383,14 +384,14 @@ function Publish-UpgradedServiceFabricApplication
if ($UnregisterUnusedVersions)
{
Write-Host (Get-VstsLocString -Key SFSDK_UnregisterUnusedVersions)
foreach ($registeredAppTypes in Get-ServiceFabricApplicationTypeAction -ApplicationTypeName $names.ApplicationTypeName | Where-Object { $_.ApplicationTypeVersion -ne $names.ApplicationTypeVersion })
foreach ($registeredAppType in Get-ServiceFabricApplicationTypeAction -ApplicationTypeName $names.ApplicationTypeName)
{
try
{
$global:operationId = $SF_Operations.UnregisterApplicationType
$registeredAppTypes | Unregister-ServiceFabricApplicationType -Force -TimeoutSec $UnregisterPackageTimeoutSec
$registeredAppType | Unregister-ServiceFabricApplicationType -Force -TimeoutSec $UnregisterPackageTimeoutSec
}
catch [System.Fabric.FabricException]
catch
{
# AppType and Version in use.
}
Expand Down