Skip to content

Commit

Permalink
improving success criteria for war package deployment . (#7063) (#7066)…
Browse files Browse the repository at this point in the history
… (#7119)
  • Loading branch information
hiyadav authored May 7, 2018
1 parent 73ffd39 commit 7684368
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var msDeploy = require('webdeployment-common/deployusingmsdeploy.js');

export async function DeployWar(webPackage, taskParams: TaskParameters, msDeployPublishingProfile, kuduService: Kudu, appServiceUtility: AzureAppServiceUtility): Promise<void> {
// get list of files before deploying to the web app.
await appServiceUtility.pingApplication();
var listOfFilesBeforeDeployment: any = await kuduService.listDir('/site/wwwroot/webapps/');
tl.debug("Listing file structure of webapps folder before deployment starts => " + JSON.stringify(listOfFilesBeforeDeployment));

Expand Down Expand Up @@ -64,6 +65,6 @@ export async function HasWarExpandedSuccessfully(kuduService: Kudu, directoryWit

// Verify if the content of that war file has successfully expanded. This is can be concluded if
// directory with same name as war file exists after deployment and if it existed before deployment, then the directory should contain content of new war file
// which can be concluded if the modified time of the directory has changed.
return filesAfterDeployment.some(item => { return item.name == warFileName && item.mime == "inode/directory" && (!directoryWithSameNameBeforeDeployment || item.mtime != directoryWithSameNameBeforeDeployment.mtime) });
// which can be concluded if the modified time of the directory has changed. We have however observerd some minor milliseconds change in the modified time even when deployment is not successfull, only for the first time. Hence we are introducing a check that the time change should be more than 0.5 second or 500 milliseconds.
return filesAfterDeployment.some(item => { return item.name == warFileName && item.mime == "inode/directory" && (!directoryWithSameNameBeforeDeployment || (item.mtime != directoryWithSameNameBeforeDeployment.mtime && (new Date(item.mtime).getTime() - new Date(directoryWithSameNameBeforeDeployment.mtime).getTime() > 500))) });
}
2 changes: 1 addition & 1 deletion Tasks/AzureRmWebAppDeployment/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 3,
"Minor": 3,
"Patch": 46
"Patch": 47
},
"releaseNotes": "What's new in Version 3.0: <br/>&nbsp;&nbsp;Supports File Transformations (XDT) <br/>&nbsp;&nbsp;Supports Variable Substitutions(XML, JSON) <br/>Click [here](https://aka.ms/azurermwebdeployreadme) for more Information.",
"minimumAgentVersion": "2.104.1",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/AzureRmWebAppDeployment/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 3,
"Minor": 3,
"Patch": 46
"Patch": 47
},
"releaseNotes": "ms-resource:loc.releaseNotes",
"minimumAgentVersion": "2.104.1",
Expand Down

0 comments on commit 7684368

Please sign in to comment.