From 47eb0883adf200b4e12ceb80bb2ed70252836a5a Mon Sep 17 00:00:00 2001 From: vinca Date: Fri, 15 Jun 2018 15:35:00 +0530 Subject: [PATCH] App service minor fixed --- .../BuiltInLinuxWebAppDeploymentProvider.ts | 1 + .../operations/AzureAppServiceUtility.ts | 10 ++++++++-- .../operations/KuduServiceUtility.ts | 11 +++++++++++ .../Common/azure-arm-rest/azure-arm-app-service.ts | 13 +++++++++++-- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Tasks/AzureRmWebAppDeploymentV4/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts b/Tasks/AzureRmWebAppDeploymentV4/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts index fc0c6608af5d..d7d4f8caa69a 100644 --- a/Tasks/AzureRmWebAppDeploymentV4/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts +++ b/Tasks/AzureRmWebAppDeploymentV4/deploymentProvider/BuiltInLinuxWebAppDeploymentProvider.ts @@ -9,6 +9,7 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen public async DeployWebAppStep() { tl.debug('Performing Linux built-in package deployment'); + await this.kuduServiceUtility.warmpUp(); this.zipDeploymentID = await this.kuduServiceUtility.zipDeploy(this.taskParams.Package.getPath(), false, this.taskParams.TakeAppOfflineFlag, { slotName: this.appService.getSlot() }); diff --git a/Tasks/AzureRmWebAppDeploymentV4/operations/AzureAppServiceUtility.ts b/Tasks/AzureRmWebAppDeploymentV4/operations/AzureAppServiceUtility.ts index 25eff3df2780..9764b2885453 100644 --- a/Tasks/AzureRmWebAppDeploymentV4/operations/AzureAppServiceUtility.ts +++ b/Tasks/AzureRmWebAppDeploymentV4/operations/AzureAppServiceUtility.ts @@ -141,9 +141,15 @@ export class AzureAppServiceUtility { } console.log(tl.loc('UpdatingAppServiceApplicationSettings', JSON.stringify(properties))); - await this._appService.patchApplicationSettings(properties); + var isNewValueUpdated: boolean = await this._appService.patchApplicationSettings(properties); + + if(!isNewValueUpdated) { + console.log(tl.loc('UpdatedAppServiceApplicationSettings')); + return; + } + var kuduService = await this.getKuduService(); - var noOftimesToIterate: number = 6; + var noOftimesToIterate: number = 12; tl.debug('retrieving values from Kudu service to check if new values are updated'); while(noOftimesToIterate > 0) { var kuduServiceAppSettings = await kuduService.getAppSettings(); diff --git a/Tasks/AzureRmWebAppDeploymentV4/operations/KuduServiceUtility.ts b/Tasks/AzureRmWebAppDeploymentV4/operations/KuduServiceUtility.ts index 1b6fc9f597ed..d28848e3d776 100644 --- a/Tasks/AzureRmWebAppDeploymentV4/operations/KuduServiceUtility.ts +++ b/Tasks/AzureRmWebAppDeploymentV4/operations/KuduServiceUtility.ts @@ -218,6 +218,17 @@ export class KuduServiceUtility { } } + public async warmpUp() { + try { + tl.debug('warming up Kudu Service'); + await this._appServiceKuduService.getAppSettings(); + tl.debug('warmed up Kudu Service'); + } + catch(error) { + tl.debug('Failed to warm-up Kudu: ' + error.toString()); + } + } + private async _printZipDeployLogs(log_url: string): Promise { if(!log_url) { return; diff --git a/Tasks/Common/azure-arm-rest/azure-arm-app-service.ts b/Tasks/Common/azure-arm-rest/azure-arm-app-service.ts index 1f59fcc908ad..1643c63f6dc3 100644 --- a/Tasks/Common/azure-arm-rest/azure-arm-app-service.ts +++ b/Tasks/Common/azure-arm-rest/azure-arm-app-service.ts @@ -207,14 +207,23 @@ export class AzureAppService { } } - public async patchApplicationSettings(properties): Promise { + public async patchApplicationSettings(properties): Promise { var applicationSettings = await this.getApplicationSettings(); + var isNewValueUpdated: boolean = false; for(var key in properties) { + if(applicationSettings.properties[key] != properties[key]) { + tl.debug(`old value : ${applicationSettings.properties[key]}. new value: ${properties[key]}`); + isNewValueUpdated = true; + } + applicationSettings.properties[key] = properties[key]; } - await this.updateApplicationSettings(applicationSettings); + if(isNewValueUpdated) { + await this.updateApplicationSettings(applicationSettings); + } + return isNewValueUpdated; } public async getConfiguration(): Promise {