Skip to content

Commit

Permalink
App service minor fixed (#7497)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent1173 authored Jun 18, 2018
1 parent b72a50c commit 49aa977
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 11 additions & 0 deletions Tasks/AzureRmWebAppDeploymentV4/operations/KuduServiceUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
if(!log_url) {
return;
Expand Down
13 changes: 11 additions & 2 deletions Tasks/Common/azure-arm-rest/azure-arm-app-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,23 @@ export class AzureAppService {
}
}

public async patchApplicationSettings(properties): Promise<void> {
public async patchApplicationSettings(properties): Promise<boolean> {
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<AzureAppServiceConfigurationDetails> {
Expand Down

0 comments on commit 49aa977

Please sign in to comment.