-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Changes from 3 commits
7539d90
b90cbd1
daeea7e
bd14d5a
72f1512
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
{ | ||
|
@@ -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) | ||
|
||
|
@@ -383,7 +384,7 @@ 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 ($registeredAppTypes in Get-ServiceFabricApplicationTypeAction -ApplicationTypeName $names.ApplicationTypeName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for the info, please let me know the reason to remove 'Where-Object' clause from the query There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $UnregisterUnusedVersions means that any unused type should be unregistered. We were excluding current version as it is being used in upgrade. However, the upgrade might fail and that means type is not in use. Hence, now we will try to unregister all types. If upgrade was successful, unregister to current type will fail - but that error will be supressed. |
||
{ | ||
try | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If business use case is to consume the error in case of AppType and Version in use then its better to check for error code "ApplicationTypeInUse" instead of consuming System.Fabric.FabricException There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO use case is to suppress any kind of exception. We don't want task to fail due to failure here. Infact I will remove [System.Fabric.FabricException] from here as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets communicate to the users by surfacing a warning message in case of failures There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename variable $registeredAppTypes to $registeredAppType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#Fixed