Skip to content

Commit 4b06ce4

Browse files
authored
Moved UseDiffPackage checkbox to Upgrade section and Moving up the logic for skip upgrade (#7384)
* Moved UseDiffPackage checkbox to Upgrade section and enabled it by default (#7345) * Moved UseDiffPackage checkbox to Upgrade section and enabled it by default * Keeping default value same * Moving input code location * Updating patch version * Moving up the logic for skip upgrade (#7373) * Moving up the logic to skip upgrade * Moving up the logic to check the existence of old application * Modified code as per review comments * Revert "Moved UseDiffPackage checkbox to Upgrade section and enabled it by default (#7345)" This reverts commit a1b9ff5.
1 parent a066c4c commit 4b06ce4

File tree

3 files changed

+41
-44
lines changed

3 files changed

+41
-44
lines changed

Tasks/ServiceFabricDeploy/ServiceFabricSDK/Publish-UpgradedServiceFabricApplication.ps1

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,45 @@ function Publish-UpgradedServiceFabricApplication
146146
throw $errMsg
147147
}
148148

149+
$ApplicationManifestPath = "$AppPkgPathToUse\ApplicationManifest.xml"
150+
151+
$names = Get-NamesFromApplicationManifest -ApplicationManifestPath $ApplicationManifestPath
152+
if (!$names)
153+
{
154+
return
155+
}
156+
157+
# If ApplicationName is not specified on command line get application name from Application parameter file.
158+
if (!$ApplicationName)
159+
{
160+
$ApplicationName = Get-ApplicationNameFromApplicationParameterFile $ApplicationParameterFilePath
161+
}
162+
163+
if (!$ApplicationName)
164+
{
165+
Write-Error (Get-VstsLocString -Key EmptyApplicationName)
166+
}
167+
168+
$oldApplication = Get-ServiceFabricApplication -ApplicationName $ApplicationName
169+
## Check existence of the application
170+
if (!$oldApplication)
171+
{
172+
$errMsg = (Get-VstsLocString -Key SFSDK_AppDoesNotExist -ArgumentList $ApplicationName)
173+
throw $errMsg
174+
}
175+
176+
if ($oldApplication.ApplicationTypeName -ne $names.ApplicationTypeName)
177+
{
178+
$errMsg = (Get-VstsLocString -Key SFSDK_AppTypeMismatch -ArgumentList $ApplicationName)
179+
throw $errMsg
180+
}
181+
182+
if ($SkipUpgradeSameTypeAndVersion -And $oldApplication.ApplicationTypeVersion -eq $names.ApplicationTypeVersion)
183+
{
184+
Write-Warning (Get-VstsLocString -Key SFSDK_SkipUpgradeWarning -ArgumentList @($names.ApplicationTypeName, $names.ApplicationTypeVersion))
185+
return
186+
}
187+
149188
# Get image store connection string
150189
$clusterManifestText = Get-ServiceFabricClusterManifest
151190
$imageStoreConnectionString = Get-ImageStoreConnectionStringFromClusterManifest ([xml] $clusterManifestText)
@@ -160,8 +199,6 @@ function Publish-UpgradedServiceFabricApplication
160199
}
161200
}
162201

163-
$ApplicationManifestPath = "$AppPkgPathToUse\ApplicationManifest.xml"
164-
165202
try
166203
{
167204
[void](Test-ServiceFabricClusterConnection)
@@ -172,49 +209,9 @@ function Publish-UpgradedServiceFabricApplication
172209
throw
173210
}
174211

175-
# If ApplicationName is not specified on command line get application name from Application parameter file.
176-
if (!$ApplicationName)
177-
{
178-
$ApplicationName = Get-ApplicationNameFromApplicationParameterFile $ApplicationParameterFilePath
179-
}
180-
181-
if (!$ApplicationName)
182-
{
183-
Write-Error (Get-VstsLocString -Key EmptyApplicationName)
184-
}
185-
186-
$names = Get-NamesFromApplicationManifest -ApplicationManifestPath $ApplicationManifestPath
187-
if (!$names)
188-
{
189-
return
190-
}
191-
192212
$ApplicationTypeAlreadyRegistered = $false
193213
if ($Action.Equals('RegisterAndUpgrade') -or $Action.Equals('Register'))
194214
{
195-
## Check existence of the application
196-
$oldApplication = Get-ServiceFabricApplication -ApplicationName $ApplicationName
197-
198-
if (!$oldApplication)
199-
{
200-
$errMsg = (Get-VstsLocString -Key SFSDK_AppDoesNotExist -ArgumentList $ApplicationName)
201-
throw $errMsg
202-
}
203-
else
204-
{
205-
if ($oldApplication.ApplicationTypeName -ne $names.ApplicationTypeName)
206-
{
207-
$errMsg = (Get-VstsLocString -Key SFSDK_AppTypeMismatch -ArgumentList $ApplicationName)
208-
throw $errMsg
209-
}
210-
211-
if ($SkipUpgradeSameTypeAndVersion -And $oldApplication.ApplicationTypeVersion -eq $names.ApplicationTypeVersion)
212-
{
213-
Write-Warning (Get-VstsLocString -Key SFSDK_SkipUpgradeWarning -ArgumentList @($names.ApplicationTypeName, $names.ApplicationTypeVersion))
214-
return
215-
}
216-
}
217-
218215
## Check upgrade status
219216
$upgradeStatus = Get-ServiceFabricApplicationUpgrade -ApplicationName $ApplicationName
220217
if ($upgradeStatus.UpgradeState -ne "RollingBackCompleted" -and $upgradeStatus.UpgradeState -ne "RollingForwardCompleted")

Tasks/ServiceFabricDeploy/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"version": {
1818
"Major": 1,
1919
"Minor": 7,
20-
"Patch": 9
20+
"Patch": 10
2121
},
2222
"demands": [
2323
"Cmd"

Tasks/ServiceFabricDeploy/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"version": {
1818
"Major": 1,
1919
"Minor": 7,
20-
"Patch": 9
20+
"Patch": 10
2121
},
2222
"demands": [
2323
"Cmd"

0 commit comments

Comments
 (0)