Skip to content

Commit

Permalink
Removed azure-pipelines-tasks-azurermdeploycommon dependency (#18073)
Browse files Browse the repository at this point in the history
* Replaced azure-pipelines-tasks-azurermdeploycommon dependency usage with arm-rest-v2

* Added azure-pipelines-task-lib removal from 2nd level dependency node modules

* Update arm rest version

* Bump up version to 100

* Update lock file

* Fix azure-pipelines-task-lib version

---------

Co-authored-by: Ondrej Netocny <onetocny@microsoft.com>
  • Loading branch information
starkmsu and onetocny authored Apr 24, 2023
1 parent af31d3d commit d033d56
Show file tree
Hide file tree
Showing 17 changed files with 1,099 additions and 150 deletions.
4 changes: 2 additions & 2 deletions Tasks/AzureWebAppV1/azurermwebappdeployment.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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 { TaskParameters, TaskParametersUtility } from './taskparameters';
import { DeploymentFactory } from './deploymentProvider/DeploymentFactory';
import * as Endpoint from 'azure-pipelines-tasks-azurermdeploycommon/azure-arm-rest/azure-arm-endpoint';

async function main() {
let isDeploymentSuccess: boolean = true;

try {
tl.setResourcePath(path.join( __dirname, 'task.json'));
tl.setResourcePath(path.join( __dirname, 'node_modules/azure-pipelines-tasks-azurermdeploycommon/module.json'));
tl.setResourcePath(path.join( __dirname, 'node_modules/azure-pipelines-tasks-azure-arm-rest-v2/module.json'));
var taskParams: TaskParameters = await TaskParametersUtility.getParameters();
var deploymentFactory: DeploymentFactory = new DeploymentFactory(taskParams);
var deploymentProvider = await deploymentFactory.GetDeploymentProvider();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'

import { AzureAppService } from 'azure-pipelines-tasks-azurermdeploycommon/azure-arm-rest/azure-arm-app-service';
import { AzureAppServiceUtility } from 'azure-pipelines-tasks-azurermdeploycommon/operations/AzureAppServiceUtility';
import { AzureDeployPackageArtifactAlias } from 'azure-pipelines-tasks-azurermdeploycommon/Constants';
import { AzureEndpoint } from 'azure-pipelines-tasks-azurermdeploycommon/azure-arm-rest/azureModels';
import { AzureRmEndpointAuthenticationScheme } from 'azure-pipelines-tasks-azurermdeploycommon/azure-arm-rest/constants';
import { IWebAppDeploymentProvider } from './IWebAppDeploymentProvider';
import { Kudu } from 'azure-pipelines-tasks-azurermdeploycommon/azure-arm-rest/azure-arm-app-service-kudu';
import { KuduServiceUtility } from 'azure-pipelines-tasks-azurermdeploycommon/operations/KuduServiceUtility';
import { PackageUtility } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import { TaskParameters } from '../taskparameters';
import { addReleaseAnnotation } from 'azure-pipelines-tasks-azurermdeploycommon/operations/ReleaseAnnotationUtility';

import tl = require('azure-pipelines-task-lib/task');

import publishProfileUtility = require("azure-pipelines-tasks-utility-common/publishProfileUtility");
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 { AzureEndpoint } from 'azure-pipelines-tasks-azure-arm-rest-v2/azureModels';
import { AzureAppServiceUtility } from 'azure-pipelines-tasks-azure-arm-rest-v2/azureAppServiceUtility';
import { AzureRmEndpointAuthenticationScheme, AzureDeployPackageArtifactAlias } from 'azure-pipelines-tasks-azure-arm-rest-v2/constants';
import { PackageUtility } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility'
import { TaskParameters } from '../taskparameters';
import { AzureAppServiceUtilityExt } from '../operations/AzureAppServiceUtilityExt';
import { KuduServiceUtility } from '../operations/KuduServiceUtility';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
import { IWebAppDeploymentProvider } from './IWebAppDeploymentProvider';

export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvider {
protected taskParams:TaskParameters;
protected appService: AzureAppService;
protected kuduService: Kudu;
protected appServiceUtility: AzureAppServiceUtility;
protected appServiceUtilityExt: AzureAppServiceUtilityExt;
protected kuduServiceUtility: KuduServiceUtility;
protected virtualApplicationPath: string = "";
protected activeDeploymentID;
Expand Down Expand Up @@ -56,9 +54,10 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide
let resourceIdSplit = resourceId.split("/");
this.slotName = resourceIdSplit.length === 11 ? resourceIdSplit[10] : "production";
} else {
this.appService = new AzureAppService(this.taskParams.azureEndpoint, this.taskParams.ResourceGroupName, this.taskParams.WebAppName,
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.slotName = this.appService.getSlot();
}
Expand Down Expand Up @@ -96,10 +95,10 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide

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

await this.appServiceUtility.updateScmTypeAndConfigurationDetails();
await this.appServiceUtilityExt.updateScmTypeAndConfigurationDetails();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'

import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';

import tl = require('azure-pipelines-task-lib/task');

var webCommonUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var deployUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var zipUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/ziputility.js');
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'
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

const initScriptAppSetting: string = "-INIT_SCRIPT";

Expand All @@ -18,14 +14,14 @@ export class BuiltInLinuxWebAppDeploymentProvider extends AzureRmWebAppDeploymen
let packageType = this.taskParams.Package.getPackageType();
let deploymentMethodtelemetry = packageType === PackageType.war ? '{"deploymentMethod":"War Deploy"}' : '{"deploymentMethod":"Zip Deploy"}';
console.log("##vso[telemetry.publish area=TaskDeploymentMethod;feature=AzureWebAppDeployment]" + deploymentMethodtelemetry);

tl.debug('Performing Linux built-in package deployment');

await this.kuduServiceUtility.warmpUp();

switch(packageType){
case PackageType.folder:
let tempPackagePath = deployUtility.generateTemporaryFolderOrZipPath(tl.getVariable('AGENT.TEMPDIRECTORY'), false);
let tempPackagePath = webCommonUtility.generateTemporaryFolderOrZipPath(tl.getVariable('AGENT.TEMPDIRECTORY'), false);
let archivedWebPackage = await zipUtility.archiveFolder(this.taskParams.Package.getPath(), "", tempPackagePath);
tl.debug("Compressed folder into zip " + archivedWebPackage);
this.zipDeploymentID = await this.kuduServiceUtility.deployUsingZipDeploy(archivedWebPackage);
Expand Down
8 changes: 4 additions & 4 deletions Tasks/AzureWebAppV1/deploymentProvider/DeploymentFactory.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import tl = require('azure-pipelines-task-lib/task');
import { AzureRmEndpointAuthenticationScheme } from 'azure-pipelines-tasks-azure-arm-rest-v2/constants';
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import { TaskParameters, DeploymentType } from '../taskparameters';
import { BuiltInLinuxWebAppDeploymentProvider } from './BuiltInLinuxWebAppDeploymentProvider';
import { IWebAppDeploymentProvider } from './IWebAppDeploymentProvider';
import { WindowsWebAppZipDeployProvider } from './WindowsWebAppZipDeployProvider';
import { WindowsWebAppRunFromZipProvider } from './WindowsWebAppRunFromZipProvider';
import tl = require('azure-pipelines-task-lib/task');
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import { WindowsWebAppWarDeployProvider } from './WindowsWebAppWarDeployProvider';
import { AzureRmEndpointAuthenticationScheme } from 'azure-pipelines-tasks-azurermdeploycommon/azure-arm-rest/constants';
import { WindowsWebAppZipDeployProvider } from './WindowsWebAppZipDeployProvider';

export class DeploymentFactory {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'

import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';
import { DeploymentType } from '../taskparameters';
import { FileTransformsUtility } from 'azure-pipelines-tasks-azurermdeploycommon/operations/FileTransformsUtility.js';
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';
import { addReleaseAnnotation } from 'azure-pipelines-tasks-azurermdeploycommon/operations/ReleaseAnnotationUtility';

import tl = require('azure-pipelines-task-lib/task');

var deployUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var zipUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/ziputility.js');
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'
import { DeploymentType } from '../taskparameters';
import { FileTransformsUtility } from '../operations/FileTransformsUtility';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

const oldRunFromZipAppSetting: string = '-WEBSITE_RUN_FROM_ZIP';
const runFromZipAppSetting: string = '-WEBSITE_RUN_FROM_PACKAGE 1';

export class WindowsWebAppRunFromZipProvider extends AzureRmWebAppDeploymentProvider {

public async DeployWebAppStep() {
let deploymentMethodtelemetry = '{"deploymentMethod":"Run from Package"}';
console.log("##vso[telemetry.publish area=TaskDeploymentMethod;feature=AzureWebAppDeployment]" + deploymentMethodtelemetry);

var webPackage = await FileTransformsUtility.applyTransformations(this.taskParams.Package.getPath(), this.taskParams.WebConfigParameters, this.taskParams.Package.getPackageType());

if(this.taskParams.DeploymentType === DeploymentType.runFromPackage) {
var _isMSBuildPackage = await this.taskParams.Package.isMSBuildPackage();
if(_isMSBuildPackage) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

import tl = require('azure-pipelines-task-lib/task');
var webCommonUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var webCommonUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

export class WindowsWebAppWarDeployProvider extends AzureRmWebAppDeploymentProvider {

private zipDeploymentID: string;

public async DeployWebAppStep() {

tl.debug("Initiated deployment via kudu service for webapp war package : "+ this.taskParams.Package.getPath());

let deploymentMethodtelemetry = '{"deploymentMethod":"War Deploy"}';
console.log("##vso[telemetry.publish area=TaskDeploymentMethod;feature=AzureWebAppDeployment]" + deploymentMethodtelemetry);

await this.kuduServiceUtility.warmpUp();

var warName = this.taskParams.CustomWarName || 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.slotName }, warName);

await this.PostDeploymentStep();
}

public async UpdateDeploymentStatus(isDeploymentSuccess: boolean) {
await super.UpdateDeploymentStatus(isDeploymentSuccess);
if(this.kuduServiceUtility) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import * as ParameterParser from 'azure-pipelines-tasks-azurermdeploycommon/operations/ParameterParserUtility'

import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';
import { DeploymentType } from '../taskparameters';
import { FileTransformsUtility } from 'azure-pipelines-tasks-azurermdeploycommon/operations/FileTransformsUtility.js';
import { PackageType } from 'azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/packageUtility';

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 * as ParameterParser from 'azure-pipelines-tasks-webdeployment-common/ParameterParserUtility'
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import { DeploymentType } from '../taskparameters';
import { FileTransformsUtility } from '../operations/FileTransformsUtility';
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

const removeRunFromZipAppSetting: string = '-WEBSITE_RUN_FROM_PACKAGE -WEBSITE_RUN_FROM_ZIP';
var deployUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/utility.js');
var zipUtility = require('azure-pipelines-tasks-azurermdeploycommon/webdeployment-common/ziputility.js');

export class WindowsWebAppZipDeployProvider extends AzureRmWebAppDeploymentProvider {

private zipDeploymentID: string;

public async DeployWebAppStep() {
let deploymentMethodtelemetry = '{"deploymentMethod":"Zip Deploy"}';
console.log("##vso[telemetry.publish area=TaskDeploymentMethod;feature=AzureWebAppDeployment]" + deploymentMethodtelemetry);
Expand Down
8 changes: 8 additions & 0 deletions Tasks/AzureWebAppV1/make.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"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 d033d56

Please sign in to comment.