Skip to content

Commit 58755ec

Browse files
authored
Zip Deployment: Return Fail Deployment if Zip Deployment endpoint doesn't return success result. (Azure#18593)
* adding check for zip deployment * update the change log
1 parent e125e5b commit 58755ec

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Websites/Websites/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
## Version 2.11.2
2323
* Updated `Get-AzWebApp` and `Get-AzWebAppSlot` to expose `VirtualNetworkSubnetId` property [#18042]
24+
* Updated `Publish-AzWebApp` to avoid the false positive result when zip deploy is not reachable.
2425
## Version 2.11.1
2526
* Updated 'New-AzWebAppContainerPSSession' with CmdletDeprecation Attribute [#16646]
2627
* Updated `Restore-AzDeletedWebApp` to fix issue that prevents the cmdlet from working on hosts with a locale is anything different from `en-US`

src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ public override void ExecuteCmdlet()
8989
fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/zip");
9090
r = client.PostAsync(deployUrl, fileContent).Result;
9191

92+
// Checking the response of the post request. If the post request fails with 502 or 503 HTTP status
93+
// then deployments/latest endpoint may give false postive result.
94+
if (r.StatusCode != HttpStatusCode.OK && r.StatusCode != HttpStatusCode.Accepted)
95+
{
96+
var rec = new ErrorRecord(new Exception("Deployment failed with status code " + r.StatusCode), string.Empty, ErrorCategory.InvalidResult, null);
97+
WriteError(rec);
98+
return;
99+
}
100+
92101
int numChecks = 0;
93102
do
94103
{

0 commit comments

Comments
 (0)