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

Zip Deployment: Return Fail Deployment if Zip Deployment endpoint doesn't return success result. #18593

Merged
merged 2 commits into from
Jun 17, 2022
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
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