Skip to content

Commit

Permalink
Zip Deployment: Return Fail Deployment if Zip Deployment endpoint doe…
Browse files Browse the repository at this point in the history
…sn't return success result. (#18593)

* adding check for zip deployment

* update the change log
  • Loading branch information
khkh-ms authored Jun 17, 2022
1 parent e125e5b commit 58755ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Websites/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

## Version 2.11.2
* Updated `Get-AzWebApp` and `Get-AzWebAppSlot` to expose `VirtualNetworkSubnetId` property [#18042]
* Updated `Publish-AzWebApp` to avoid the false positive result when zip deploy is not reachable.
## Version 2.11.1
* Updated 'New-AzWebAppContainerPSSession' with CmdletDeprecation Attribute [#16646]
* Updated `Restore-AzDeletedWebApp` to fix issue that prevents the cmdlet from working on hosts with a locale is anything different from `en-US`
Expand Down
9 changes: 9 additions & 0 deletions src/Websites/Websites/Cmdlets/WebApps/PublishAzureWebApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ public override void ExecuteCmdlet()
fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/zip");
r = client.PostAsync(deployUrl, fileContent).Result;

// Checking the response of the post request. If the post request fails with 502 or 503 HTTP status
// then deployments/latest endpoint may give false postive result.
if (r.StatusCode != HttpStatusCode.OK && r.StatusCode != HttpStatusCode.Accepted)
{
var rec = new ErrorRecord(new Exception("Deployment failed with status code " + r.StatusCode), string.Empty, ErrorCategory.InvalidResult, null);
WriteError(rec);
return;
}

int numChecks = 0;
do
{
Expand Down

0 comments on commit 58755ec

Please sign in to comment.