azure-pipelines-tasks-azurermdeploycommon 3.221.2 → 3.222.0

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
 
@@ -143,13 +143,24 @@ class AzureAppServiceUtility {
143
143
  const scmPolicyCheck = yield this.isSitePublishingCredentialsEnabled();
144
144
  let token = "";
145
145
  let method = "";
146
+ const password = publishingCredentials.properties["publishingPassword"];
147
+ const userName = publishingCredentials.properties["publishingUserName"];
146
148
  if (scmPolicyCheck === false) {
147
149
  token = yield this._appService._client.getCredentials().getToken();
148
150
  method = "Bearer";
151
+ // Though bearer AuthN is used, lets try to set publish profile password for mask hints to maintain compat with old behavior for MSDEPLOY.
152
+ // This needs to be cleaned up once MSDEPLOY suppport is reomve. Safe handle the exception setting up mask hint as we dont want to fail here.
153
+ try {
154
+ tl.setVariable(`AZURE_APP_MSDEPLOY_${this._appService.getSlot()}_PASSWORD`, password, true);
155
+ }
156
+ catch (error) {
157
+ // safe handle the exception setting up mask hint
158
+ tl.debug(`Setting mask hint for publish profile password failed with error: ${error}`);
159
+ }
149
160
  }
150
161
  else {
151
- tl.setVariable(`AZURE_APP_SERVICE_KUDU_${this._appService.getSlot()}_PASSWORD`, publishingCredentials.properties["publishingPassword"], true);
152
- const buffer = new Buffer(publishingCredentials.properties["publishingUserName"] + ':' + publishingCredentials.properties["publishingPassword"]);
162
+ tl.setVariable(`AZURE_APP_SERVICE_KUDU_${this._appService.getSlot()}_PASSWORD`, password, true);
163
+ const buffer = new Buffer(userName + ':' + password);
153
164
  token = buffer.toString('base64');
154
165
  method = "Basic";
155
166
  }
@@ -137,12 +137,27 @@ export class AzureAppServiceUtility {
137
137
  let token = "";
138
138
  let method = "";
139
139
 
140
+ const password = publishingCredentials.properties["publishingPassword"];
141
+ const userName = publishingCredentials.properties["publishingUserName"];
142
+
140
143
  if(scmPolicyCheck === false) {
141
144
  token = await this._appService._client.getCredentials().getToken();
142
145
  method = "Bearer";
146
+
147
+
148
+ // Though bearer AuthN is used, lets try to set publish profile password for mask hints to maintain compat with old behavior for MSDEPLOY.
149
+ // This needs to be cleaned up once MSDEPLOY suppport is reomve. Safe handle the exception setting up mask hint as we dont want to fail here.
150
+ try {
151
+ tl.setVariable(`AZURE_APP_MSDEPLOY_${this._appService.getSlot()}_PASSWORD`, password, true);
152
+ }
153
+ catch (error) {
154
+ // safe handle the exception setting up mask hint
155
+ tl.debug(`Setting mask hint for publish profile password failed with error: ${error}`);
156
+ }
157
+
143
158
  } else {
144
- tl.setVariable(`AZURE_APP_SERVICE_KUDU_${this._appService.getSlot()}_PASSWORD`, publishingCredentials.properties["publishingPassword"], true);
145
- const buffer = new Buffer(publishingCredentials.properties["publishingUserName"] + ':' + publishingCredentials.properties["publishingPassword"]);
159
+ tl.setVariable(`AZURE_APP_SERVICE_KUDU_${this._appService.getSlot()}_PASSWORD`, password, true);
160
+ const buffer = new Buffer(userName + ':' + password);
146
161
  token = buffer.toString('base64');
147
162
  method = "Basic";
148
163
  }
@@ -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.2",
3
+ "version": "3.222.0",
4
4
  "description": "Common Lib for Azure ARM REST apis",
5
5
  "repository": {
6
6
  "type": "git",