azure-pipelines-tasks-azurermdeploycommon 3.221.3 → 3.222.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -349,7 +349,7 @@ class AzureAppService {
349
349
  '{name}': this._name,
350
350
  }, null, '2018-02-01');
351
351
  var response = yield this._client.beginRequest(httpRequest);
352
- if (response.statusCode != 200) {
352
+ if (response.statusCode != 200 && response.statusCode != 202) {
353
353
  throw AzureServiceClient_1.ToError(response);
354
354
  }
355
355
  return response.body;
@@ -378,7 +378,7 @@ export class AzureAppService {
378
378
  }, null, '2018-02-01');
379
379
 
380
380
  var response = await this._client.beginRequest(httpRequest);
381
- if(response.statusCode != 200) {
381
+ if(response.statusCode != 200 && response.statusCode != 202) {
382
382
  throw ToError(response);
383
383
  }
384
384
 
@@ -12,11 +12,12 @@ export declare class AzureAppServiceUtility {
12
12
  private getKuduAuthHeader;
13
13
  getPhysicalPath(virtualApplication: string): Promise<string>;
14
14
  updateConfigurationSettings(properties: any, formatJSON?: boolean): Promise<void>;
15
- updateAndMonitorAppSettings(addProperties?: any, deleteProperties?: any, formatJSON?: boolean): Promise<boolean>;
15
+ updateAndMonitorAppSettings(addProperties?: any, deleteProperties?: any, formatJSON?: boolean, perSlot?: boolean): Promise<boolean>;
16
16
  updateConnectionStrings(addProperties: any): Promise<boolean>;
17
17
  enableRenameLockedFiles(): Promise<void>;
18
18
  updateStartupCommandAndRuntimeStack(runtimeStack: string, startupCommand?: string): Promise<void>;
19
19
  isSitePublishingCredentialsEnabled(): Promise<boolean>;
20
20
  private _getPhysicalToVirtualPathMap;
21
21
  private _getNewMetadata;
22
+ isFunctionAppOnCentauri(): Promise<boolean>;
22
23
  }
@@ -205,7 +205,7 @@ class AzureAppServiceUtility {
205
205
  console.log(tl.loc('UpdatedAppServiceConfigurationSettings'));
206
206
  });
207
207
  }
208
- updateAndMonitorAppSettings(addProperties, deleteProperties, formatJSON) {
208
+ updateAndMonitorAppSettings(addProperties, deleteProperties, formatJSON, perSlot = true) {
209
209
  return __awaiter(this, void 0, void 0, function* () {
210
210
  if (formatJSON) {
211
211
  var appSettingsProperties = {};
@@ -240,7 +240,9 @@ class AzureAppServiceUtility {
240
240
  else {
241
241
  console.log(tl.loc('AppServiceApplicationSettingsAlreadyPresent'));
242
242
  }
243
- yield this._appService.patchApplicationSettingsSlot(addProperties);
243
+ if (perSlot) {
244
+ yield this._appService.patchApplicationSettingsSlot(addProperties);
245
+ }
244
246
  return isNewValueUpdated;
245
247
  });
246
248
  }
@@ -390,5 +392,23 @@ class AzureAppServiceUtility {
390
392
  }
391
393
  return newProperties;
392
394
  }
395
+ isFunctionAppOnCentauri() {
396
+ return __awaiter(this, void 0, void 0, function* () {
397
+ try {
398
+ let details = yield this._appService.get();
399
+ if (details.properties["managedEnvironmentId"]) {
400
+ tl.debug("Function Container app is on Centauri.");
401
+ return true;
402
+ }
403
+ else {
404
+ return false;
405
+ }
406
+ }
407
+ catch (error) {
408
+ tl.debug(`Skipping Centauri check: ${error}`);
409
+ return false;
410
+ }
411
+ });
412
+ }
393
413
  }
394
414
  exports.AzureAppServiceUtility = AzureAppServiceUtility;
@@ -209,7 +209,7 @@ export class AzureAppServiceUtility {
209
209
  console.log(tl.loc('UpdatedAppServiceConfigurationSettings'));
210
210
  }
211
211
 
212
- public async updateAndMonitorAppSettings(addProperties?: any, deleteProperties?: any, formatJSON?: boolean): Promise<boolean> {
212
+ public async updateAndMonitorAppSettings(addProperties?: any, deleteProperties?: any, formatJSON?: boolean, perSlot: boolean = true): Promise<boolean> {
213
213
  if(formatJSON) {
214
214
  var appSettingsProperties = {};
215
215
  for(var property in addProperties) {
@@ -251,7 +251,9 @@ export class AzureAppServiceUtility {
251
251
  console.log(tl.loc('AppServiceApplicationSettingsAlreadyPresent'));
252
252
  }
253
253
 
254
- await this._appService.patchApplicationSettingsSlot(addProperties);
254
+ if (perSlot) {
255
+ await this._appService.patchApplicationSettingsSlot(addProperties);
256
+ }
255
257
  return isNewValueUpdated;
256
258
  }
257
259
 
@@ -413,4 +415,21 @@ export class AzureAppServiceUtility {
413
415
  return newProperties;
414
416
  }
415
417
 
418
+ public async isFunctionAppOnCentauri(): Promise<boolean>{
419
+ try{
420
+ let details: any = await this._appService.get();
421
+ if (details.properties["managedEnvironmentId"]){
422
+ tl.debug("Function Container app is on Centauri.");
423
+ return true;
424
+ }
425
+ else{
426
+ return false;
427
+ }
428
+ }
429
+ catch(error){
430
+ tl.debug(`Skipping Centauri check: ${error}`);
431
+ return false;
432
+ }
433
+ }
434
+
416
435
  }
@@ -3,7 +3,7 @@ export declare class ContainerBasedDeploymentUtility {
3
3
  private _appService;
4
4
  private _appServiceUtility;
5
5
  constructor(appService: AzureAppService);
6
- deployWebAppImage(properties: any): Promise<void>;
6
+ deployWebAppImage(properties: any, restart?: boolean): Promise<void>;
7
7
  private _updateConfigurationDetails;
8
8
  private _getAzureContainerImageName;
9
9
  private _getDockerHubImageName;
@@ -29,7 +29,7 @@ class ContainerBasedDeploymentUtility {
29
29
  this._appService = appService;
30
30
  this._appServiceUtility = new AzureAppServiceUtility_1.AzureAppServiceUtility(appService);
31
31
  }
32
- deployWebAppImage(properties) {
32
+ deployWebAppImage(properties, restart = true) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
34
  let imageName = properties["ImageName"];
35
35
  let multicontainerConfigFile = properties["MulticontainerConfigFile"];
@@ -49,8 +49,10 @@ class ContainerBasedDeploymentUtility {
49
49
  }
50
50
  tl.debug("Updating the webapp configuration.");
51
51
  yield this._updateConfigurationDetails(properties["ConfigurationSettings"], properties["StartupCommand"], isLinuxApp, imageName, isMultiContainer, updatedMulticontainerConfigFile);
52
- tl.debug('making a restart request to app service');
53
- yield this._appService.restart();
52
+ if (restart) {
53
+ tl.debug('making a restart request to app service');
54
+ yield this._appService.restart();
55
+ }
54
56
  });
55
57
  }
56
58
  _updateConfigurationDetails(configSettings, startupCommand, isLinuxApp, imageName, isMultiContainer, multicontainerConfigFile) {
@@ -23,7 +23,7 @@ export class ContainerBasedDeploymentUtility {
23
23
  this._appServiceUtility = new AzureAppServiceUtility(appService);
24
24
  }
25
25
 
26
- public async deployWebAppImage(properties: any): Promise<void> {
26
+ public async deployWebAppImage(properties: any, restart: boolean = true): Promise<void> {
27
27
  let imageName: string = properties["ImageName"];
28
28
  let multicontainerConfigFile: string = properties["MulticontainerConfigFile"];
29
29
  let isMultiContainer: boolean = properties["isMultiContainer"];
@@ -46,8 +46,10 @@ export class ContainerBasedDeploymentUtility {
46
46
  tl.debug("Updating the webapp configuration.");
47
47
  await this._updateConfigurationDetails(properties["ConfigurationSettings"], properties["StartupCommand"], isLinuxApp, imageName, isMultiContainer, updatedMulticontainerConfigFile);
48
48
 
49
- tl.debug('making a restart request to app service');
50
- await this._appService.restart();
49
+ if (restart) {
50
+ tl.debug('making a restart request to app service');
51
+ await this._appService.restart();
52
+ }
51
53
  }
52
54
 
53
55
  private async _updateConfigurationDetails(configSettings: any, startupCommand: string, isLinuxApp: boolean, imageName?: string, isMultiContainer?: boolean, multicontainerConfigFile?: string): Promise<void> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-pipelines-tasks-azurermdeploycommon",
3
- "version": "3.221.3",
3
+ "version": "3.222.1",
4
4
  "description": "Common Lib for Azure ARM REST apis",
5
5
  "repository": {
6
6
  "type": "git",