Skip to content

Commit

Permalink
Revert WIF changes with migration to arm-rest-v2 (#18196)
Browse files Browse the repository at this point in the history
  • Loading branch information
starkmsu authored Apr 26, 2023
1 parent 86df310 commit e9111e2
Show file tree
Hide file tree
Showing 39 changed files with 3,923 additions and 827 deletions.
710 changes: 710 additions & 0 deletions Tasks/AzureFunctionAppV1/azure-arm-rest/azure-arm-app-service-kudu.ts

Large diffs are not rendered by default.

824 changes: 824 additions & 0 deletions Tasks/AzureFunctionAppV1/azure-arm-rest/azure-arm-app-service.ts

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Tasks/AzureFunctionAppV1/azurermwebappdeployment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tl = require('azure-pipelines-task-lib/task');
import path = require('path');
import * as Endpoint from 'azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-endpoint';
import * as Endpoint from 'azure-pipelines-tasks-azurermdeploycommon/azure-arm-rest/azure-arm-endpoint';
import { TaskParameters, TaskParametersUtility } from './taskparameters';
import { DeploymentFactory } from './deploymentProvider/DeploymentFactory';

Expand All @@ -9,7 +9,7 @@ async function main() {

try {
tl.setResourcePath(path.join( __dirname, 'task.json'));
tl.setResourcePath(path.join( __dirname, 'node_modules/azure-pipelines-tasks-azure-arm-rest-v2/module.json'));
tl.setResourcePath(path.join( __dirname, 'node_modules/azure-pipelines-tasks-azurermdeploycommon/module.json'));
var taskParams: TaskParameters = await TaskParametersUtility.getParameters();
var deploymentFactory: DeploymentFactory = new DeploymentFactory(taskParams);
var deploymentProvider = await deploymentFactory.GetDeploymentProvider();
Expand All @@ -29,7 +29,7 @@ async function main() {
if(deploymentProvider != null) {
await deploymentProvider.UpdateDeploymentStatus(isDeploymentSuccess);
}

Endpoint.dispose();
tl.debug(isDeploymentSuccess ? "Deployment Succeded" : "Deployment failed");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import tl = require('azure-pipelines-task-lib/task');
import { AzureAppService } from 'azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-app-service';
import { Kudu } from 'azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-app-service-kudu';
import { AzureDeployPackageArtifactAlias } from 'azure-pipelines-tasks-azure-arm-rest-v2/constants';
import { AzureAppServiceUtility } from 'azure-pipelines-tasks-azure-arm-rest-v2/azureAppServiceUtility';
import { PackageUtility } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility'
import { PackageUtility } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'
import { AzureDeployPackageArtifactAlias } from 'azure-pipelines-tasks-azurermdeploycommon/Constants';
import { TaskParameters } from '../taskparameters';
import { AzureAppServiceUtilityExt } from '../operations/AzureAppServiceUtilityExt';
import { AzureAppService } from '../azure-arm-rest/azure-arm-app-service';
import { Kudu } from '../azure-arm-rest/azure-arm-app-service-kudu';
import { AzureAppServiceUtility } from '../operations/AzureAppServiceUtility';
import { KuduServiceUtility } from '../operations/KuduServiceUtility';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
import { IWebAppDeploymentProvider } from './IWebAppDeploymentProvider';
Expand All @@ -16,7 +15,6 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide
protected appService: AzureAppService;
protected kuduService: Kudu;
protected appServiceUtility: AzureAppServiceUtility;
protected appServiceUtilityExt: AzureAppServiceUtilityExt;
protected kuduServiceUtility: KuduServiceUtility;
protected virtualApplicationPath: string = "";
protected activeDeploymentID;
Expand All @@ -31,12 +29,11 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide
this.appService = new AzureAppService(this.taskParams.azureEndpoint, this.taskParams.ResourceGroupName, this.taskParams.WebAppName,
this.taskParams.SlotName, this.taskParams.WebAppKind);
this.appServiceUtility = new AzureAppServiceUtility(this.appService);
this.appServiceUtilityExt = new AzureAppServiceUtilityExt(this.appService);

this.kuduService = await this.appServiceUtility.getKuduService();
this.kuduServiceUtility = new KuduServiceUtility(this.kuduService);

await this.appServiceUtilityExt.getFuntionAppNetworkingCheck(this.taskParams.isLinuxApp);
await this.appServiceUtility.getFuntionAppNetworkingCheck(this.taskParams.isLinuxApp);
}

public async DeployWebAppStep() {}
Expand All @@ -63,9 +60,9 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide

if (this.taskParams.ConfigurationSettings) {
var customApplicationSettings = ParameterParser.parse(this.taskParams.ConfigurationSettings);
await this.appService.updateConfigurationSettings(customApplicationSettings);
await this.appServiceUtility.updateConfigurationSettings(customApplicationSettings);
}

await this.appServiceUtilityExt.updateScmTypeAndConfigurationDetails();
await this.appServiceUtility.updateScmTypeAndConfigurationDetails();
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import tl = require('azure-pipelines-task-lib/task');
import path = require('path');
var webCommonUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
var zipUtility = require('azure-pipelines-tasks-webdeployment-common/ziputility');
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility'
var webCommonUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var zipUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/ziputility.js');
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

const linuxFunctionStorageSetting: string = '-WEBSITES_ENABLE_APP_SERVICE_STORAGE true';
Expand Down Expand Up @@ -40,7 +40,7 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen

tl.debug('Performing Linux built-in package deployment');
var isNewValueUpdated: boolean = false;

var linuxFunctionRuntimeSetting = "";
if(this.taskParams.RuntimeStack && linuxFunctionRuntimeSettingValue.get(this.taskParams.RuntimeStack)) {
linuxFunctionRuntimeSetting = linuxFunctionRuntimeSettingName + linuxFunctionRuntimeSettingValue.get(this.taskParams.RuntimeStack);
Expand All @@ -52,11 +52,11 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen

var customApplicationSetting = ParameterParser.parse(linuxFunctionAppSetting);
isNewValueUpdated = await this.appServiceUtility.updateAndMonitorAppSettings(customApplicationSetting);

if(!isNewValueUpdated) {
await this.kuduServiceUtility.warmpUp();
}

switch(packageType){
case PackageType.folder:
let tempPackagePath = webCommonUtility.generateTemporaryFolderOrZipPath(tl.getVariable('AGENT.TEMPDIRECTORY'), false);
Expand Down Expand Up @@ -94,7 +94,7 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen
case PackageType.war:
tl.debug("Initiated deployment via kudu service for webapp war package : "+ this.taskParams.Package.getPath());
var warName = webCommonUtility.getFileNameFromPath(this.taskParams.Package.getPath(), ".war");
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingWarDeploy(this.taskParams.Package.getPath(),
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingWarDeploy(this.taskParams.Package.getPath(),
{ slotName: this.appService.getSlot() }, warName);
break;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import tl = require('azure-pipelines-task-lib/task');
import Q = require('q');
var webCommonUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
var zipUtility = require('azure-pipelines-tasks-webdeployment-common/ziputility');
var webCommonUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var zipUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/ziputility.js');
var azureStorage = require('azure-storage');
import { AzureAppService } from 'azure-pipelines-tasks-azure-arm-rest-v2/azure-arm-app-service';
import { sleepFor } from 'azure-pipelines-tasks-azure-arm-rest-v2/webClient';
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility';
import { AzureAppServiceUtilityExt } from '../operations/AzureAppServiceUtilityExt';
import { AzureAppService } from '../azure-arm-rest/azure-arm-app-service';
import { sleepFor } from 'azure-pipelines-tasks-azurermdeploycommon/azure-arm-rest/webClient';
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility';
import { AzureAppServiceUtility } from '../operations/AzureAppServiceUtility';
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

export class ConsumptionWebAppDeploymentProvider extends AzureRmWebAppDeploymentProvider {

public async PreDeploymentStep() {
this.appService = new AzureAppService(this.taskParams.azureEndpoint, this.taskParams.ResourceGroupName, this.taskParams.WebAppName,
this.taskParams.SlotName, this.taskParams.WebAppKind, true);
this.appServiceUtilityExt = new AzureAppServiceUtilityExt(this.appService);
this.appServiceUtility = new AzureAppServiceUtility(this.appService);
}

public async DeployWebAppStep() {
Expand Down Expand Up @@ -89,15 +89,15 @@ export class ConsumptionWebAppDeploymentProvider extends AzureRmWebAppDeployment
let expiryDate = new Date(startDate);
expiryDate.setFullYear(startDate.getUTCFullYear() + 1);
startDate.setMinutes(startDate.getMinutes()-5);

let sharedAccessPolicy = {
AccessPolicy: {
Permissions: azureStorage.BlobUtilities.SharedAccessPermissions.READ,
Start: startDate,
Expiry: expiryDate
}
};

let token = blobService.generateSharedAccessSignature(containerName, blobName, sharedAccessPolicy);
let sasUrl = blobService.getUrl(containerName, blobName, token);
let index = sasUrl.indexOf("?");
Expand Down Expand Up @@ -128,10 +128,10 @@ export class ConsumptionWebAppDeploymentProvider extends AzureRmWebAppDeployment
protected async PostDeploymentStep() {
if(this.taskParams.ConfigurationSettings) {
var customApplicationSettings = ParameterParser.parse(this.taskParams.ConfigurationSettings);
await this.appService.updateConfigurationSettings(customApplicationSettings);
await this.appServiceUtility.updateConfigurationSettings(customApplicationSettings);
}

await this.appServiceUtilityExt.updateScmTypeAndConfigurationDetails();
await this.appServiceUtility.updateScmTypeAndConfigurationDetails();
}

private _getUserDefinedAppSettings() {
Expand Down
10 changes: 5 additions & 5 deletions Tasks/AzureFunctionAppV1/deploymentProvider/DeploymentFactory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tl = require('azure-pipelines-task-lib/task');
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import { TaskParameters, DeploymentType } from '../taskparameters';
import { BuiltInLinuxWebAppDeploymentProvider } from './BuiltInLinuxWebAppDeploymentProvider';
import { ConsumptionWebAppDeploymentProvider } from './ConsumptionWebAppDeploymentProvider';
Expand All @@ -23,7 +23,7 @@ export class DeploymentFactory {
return new ConsumptionWebAppDeploymentProvider(this._taskParams);
} else {
return new BuiltInLinuxWebAppDeploymentProvider(this._taskParams);
}
}
} else {
tl.debug("Deployment started for windows app service");
return await this._getWindowsDeploymentProvider()
Expand All @@ -45,11 +45,11 @@ export class DeploymentFactory {
private async _getWindowsDeploymentProviderForZipAndFolderPackageType(): Promise<IWebAppDeploymentProvider> {
if(this._taskParams.DeploymentType != DeploymentType.auto) {
return await this._getUserSelectedDeploymentProviderForWindow();
} else {
var _isMSBuildPackage = await this._taskParams.Package.isMSBuildPackage();
} else {
var _isMSBuildPackage = await this._taskParams.Package.isMSBuildPackage();
if(_isMSBuildPackage) {
throw new Error(tl.loc('MsBuildPackageNotSupported', this._taskParams.Package.getPath()));
} else {
} else {
return new WindowsWebAppRunFromZipProvider(this._taskParams);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import tl = require('azure-pipelines-task-lib/task');
var deployUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
var zipUtility = require('azure-pipelines-tasks-webdeployment-common/ziputility');
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility'
var deployUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var zipUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/ziputility.js');
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'
import { DeploymentType } from '../taskparameters';
import { FileTransformsUtility } from '../operations/FileTransformsUtility';
import { FileTransformsUtility } from 'azure-pipelines-tasks-azurermdeploycommon/operations/FileTransformsUtility.js';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

Expand Down Expand Up @@ -36,7 +36,7 @@ export class WindowsWebAppRunFromZipProvider extends AzureRmWebAppDeploymentProv
}

tl.debug("Initiated deployment via kudu service for webapp package : ");

var addCustomApplicationSetting = ParameterParser.parse(runFromZipAppSetting);
var deleteCustomApplicationSetting = ParameterParser.parse(oldRunFromZipAppSetting);
var isNewValueUpdated: boolean = await this.appServiceUtility.updateAndMonitorAppSettings(addCustomApplicationSetting, deleteCustomApplicationSetting);
Expand All @@ -45,16 +45,16 @@ export class WindowsWebAppRunFromZipProvider extends AzureRmWebAppDeploymentProv
await this.kuduServiceUtility.warmpUp();
}

await this.kuduServiceUtility.getZipDeployValidation(webPackage);
await this.kuduServiceUtility.deployUsingRunFromZip(webPackage,
await this.kuduServiceUtility.getZipDeployValidation(webPackage);
await this.kuduServiceUtility.deployUsingRunFromZip(webPackage,
{ slotName: this.appService.getSlot() });

await this.PostDeploymentStep();
}

public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) {
await addReleaseAnnotation(this.taskParams.azureEndpoint, this.appService, isDeploymentSuccess);

let appServiceApplicationUrl: string = await this.appServiceUtility.getApplicationURL();
console.log(tl.loc('AppServiceApplicationURL', appServiceApplicationUrl));
tl.setVariable('AppServiceApplicationUrl', appServiceApplicationUrl);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import tl = require('azure-pipelines-task-lib/task');
var webCommonUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
var webCommonUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

export class WindowsWebAppWarDeployProvider extends AzureRmWebAppDeploymentProvider {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import tl = require('azure-pipelines-task-lib/task');
var deployUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
var zipUtility = require('azure-pipelines-tasks-webdeployment-common/ziputility');
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility'
var deployUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var zipUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/ziputility.js');
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'
import { DeploymentType } from '../taskparameters';
import { FileTransformsUtility } from '../operations/FileTransformsUtility';
import { FileTransformsUtility } from 'azure-pipelines-tasks-azurermdeploycommon/operations/FileTransformsUtility.js';
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

const removeRunFromZipAppSetting: string = '-WEBSITE_RUN_FROM_ZIP -WEBSITE_RUN_FROM_PACKAGE';
Expand Down Expand Up @@ -36,20 +36,20 @@ export class WindowsWebAppZipDeployProvider extends AzureRmWebAppDeploymentProvi
}

tl.debug("Initiated deployment via kudu service for webapp package : ");

var deleteApplicationSetting = ParameterParser.parse(removeRunFromZipAppSetting)
var isNewValueUpdated: boolean = await this.appServiceUtility.updateAndMonitorAppSettings(null, deleteApplicationSetting);

if(!isNewValueUpdated) {
await this.kuduServiceUtility.warmpUp();
}

await this.kuduServiceUtility.getZipDeployValidation(webPackage);
await this.kuduServiceUtility.getZipDeployValidation(webPackage);
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(webPackage);

await this.PostDeploymentStep();
}

public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) {
if(this.kuduServiceUtility) {
await super.UpdateDeploymentStatus(isDeploymentSuccess);
Expand Down
8 changes: 0 additions & 8 deletions Tasks/AzureFunctionAppV1/make.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"rm": [
{
"items": [
"node_modules/azure-pipelines-tasks-azure-arm-rest-v2/node_modules/azure-pipelines-task-lib"
],
"options": "-Rf"
}
],
"externals": {
"archivePackages": [
{
Expand Down
Loading

0 comments on commit e9111e2

Please sign in to comment.