Skip to content

Commit

Permalink
Restored WorkloadIdentityFederation support (#18270)
Browse files Browse the repository at this point in the history
Restored WIF changes with migration to arm-rest-v2 (#18196)
---------
Co-authored-by: Finbar Ryan <finbarr@microsoft.com>
  • Loading branch information
starkmsu authored May 22, 2023
1 parent 7943e88 commit a6a5533
Show file tree
Hide file tree
Showing 37 changed files with 698 additions and 3,852 deletions.
710 changes: 0 additions & 710 deletions Tasks/AzureFunctionAppV1/azure-arm-rest/azure-arm-app-service-kudu.ts

This file was deleted.

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

This file was deleted.

4 changes: 2 additions & 2 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-azurermdeploycommon/azure-arm-rest/azure-arm-endpoint';
import * as Endpoint from 'azure-pipelines-tasks-azure-arm-rest-v2/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-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,11 +1,12 @@
import tl = require('azure-pipelines-task-lib/task');
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 { 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 { TaskParameters } from '../taskparameters';
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 { AzureAppServiceUtilityExt } from '../operations/AzureAppServiceUtilityExt';
import { KuduServiceUtility } from '../operations/KuduServiceUtility';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
import { IWebAppDeploymentProvider } from './IWebAppDeploymentProvider';
Expand All @@ -15,6 +16,7 @@ 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 @@ -28,12 +30,13 @@ export class AzureRmWebAppDeploymentProvider implements IWebAppDeploymentProvide
public async PreDeploymentStep() {
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.appServiceUtility = new AzureAppServiceUtility(this.appService, "AzureFunctionAppDeployment");
this.appServiceUtilityExt = new AzureAppServiceUtilityExt(this.appService);

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

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

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

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

await this.appServiceUtility.updateScmTypeAndConfigurationDetails();
await this.appServiceUtilityExt.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-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'
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 linuxFunctionStorageSetting: string = '-WEBSITES_ENABLE_APP_SERVICE_STORAGE true';
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-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');
var azureStorage = require('azure-storage');
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 { 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 { 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.appServiceUtility = new AzureAppServiceUtility(this.appService);
this.appServiceUtilityExt = new AzureAppServiceUtilityExt(this.appService);
}

public async DeployWebAppStep() {
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.appServiceUtility.updateConfigurationSettings(customApplicationSettings);
await this.appService.updateConfigurationSettings(customApplicationSettings);
}

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

private _getUserDefinedAppSettings() {
Expand Down
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-azurermdeploycommon/webdeployment-common/packageUtility';
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility';
import { TaskParameters, DeploymentType } from '../taskparameters';
import { BuiltInLinuxWebAppDeploymentProvider } from './BuiltInLinuxWebAppDeploymentProvider';
import { ConsumptionWebAppDeploymentProvider } from './ConsumptionWebAppDeploymentProvider';
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-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'
var deployUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
var zipUtility = require('azure-pipelines-tasks-webdeployment-common/ziputility');
import { applyTransformations } from 'azure-pipelines-tasks-webdeployment-common/fileTransformationsUtility';
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 'azure-pipelines-tasks-azurermdeploycommon/operations/FileTransformsUtility.js';
import { addReleaseAnnotation } from '../operations/ReleaseAnnotationUtility';
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

Expand All @@ -17,7 +17,7 @@ export class WindowsWebAppRunFromZipProvider extends AzureRmWebAppDeploymentProv
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());
var webPackage = await 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();
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-azurermdeploycommon/webdeployment-common/utility.js');
var webCommonUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
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-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'
var deployUtility = require('azure-pipelines-tasks-webdeployment-common/utility');
var zipUtility = require('azure-pipelines-tasks-webdeployment-common/ziputility');
import { applyTransformations } from 'azure-pipelines-tasks-webdeployment-common/fileTransformationsUtility';
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 'azure-pipelines-tasks-azurermdeploycommon/operations/FileTransformsUtility.js';
import { AzureRmWebAppDeploymentProvider } from './AzureRmWebAppDeploymentProvider';

const removeRunFromZipAppSetting: string = '-WEBSITE_RUN_FROM_ZIP -WEBSITE_RUN_FROM_PACKAGE';
Expand All @@ -17,7 +17,7 @@ export class WindowsWebAppZipDeployProvider extends AzureRmWebAppDeploymentProvi
let deploymentMethodtelemetry = '{"deploymentMethod":"Zip Deploy"}';
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());
var webPackage = await applyTransformations(this.taskParams.Package.getPath(), this.taskParams.WebConfigParameters, this.taskParams.Package.getPackageType());

if(this.taskParams.DeploymentType === DeploymentType.zipDeploy) {
var _isMSBuildPackage = await this.taskParams.Package.isMSBuildPackage();
Expand Down
8 changes: 8 additions & 0 deletions Tasks/AzureFunctionAppV1/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 a6a5533

Please sign in to comment.