-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added AzureRmWebAppDeploymentV5 to support OneDeploy for Linux App Se…
…rvice (#20789) * Added AzureRmWebAppDeploymentV5 to support OneDeploy for Linux App Service * updated Tests
- Loading branch information
1 parent
6b39cf3
commit 9c40bb0
Showing
300 changed files
with
53,995 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
registry=https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/ | ||
|
||
always-auth=true |
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/de-DE/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
238 changes: 238 additions & 0 deletions
238
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/en-US/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/es-ES/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/fr-FR/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/it-IT/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/ja-JP/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/ko-KR/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/ru-RU/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/zh-CN/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
229 changes: 229 additions & 0 deletions
229
Tasks/AzureRmWebAppDeploymentV5/Strings/resources.resjson/zh-TW/resources.resjson
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
registry=https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/ | ||
|
||
always-auth=true |
69 changes: 69 additions & 0 deletions
69
Tasks/AzureRmWebAppDeploymentV5/Tests/AzureRmWebAppDeploymentProviderL0Tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import tl = require('azure-pipelines-task-lib'); | ||
import { AzureRmWebAppDeploymentProvider } from '../deploymentProvider/AzureRmWebAppDeploymentProvider' | ||
import { TaskParametersUtility, TaskParameters } from '../operations/TaskParameters'; | ||
import { getMockEndpoint } from '../node_modules/azure-pipelines-tasks-azure-arm-rest/Tests/mock_utils'; | ||
import { mockAzureARMPreDeploymentSteps } from "./mock_utils"; | ||
|
||
getMockEndpoint(); | ||
mockAzureARMPreDeploymentSteps(); | ||
|
||
export class AzureRmWebAppDeploymentProviderL0Tests { | ||
|
||
public static async startAzureRmWebAppDeploymentProviderL0Tests() { | ||
await AzureRmWebAppDeploymentProviderL0Tests.testForPreDeploymentSteps(); | ||
await AzureRmWebAppDeploymentProviderL0Tests.testForPreDeploymentStepsWithSlotEnabled(); | ||
await AzureRmWebAppDeploymentProviderL0Tests.testForVirtualApplication(); | ||
await AzureRmWebAppDeploymentProviderL0Tests.testForUpdateDeploymentStatus(); | ||
} | ||
|
||
public static async testForPreDeploymentSteps() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
var azureRmWebAppDeploymentProvider : AzureRmWebAppDeploymentProvider = new AzureRmWebAppDeploymentProvider(taskParameters); | ||
await azureRmWebAppDeploymentProvider.PreDeploymentStep(); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'PreDeployment steps should succeeded but failed with error'); | ||
} | ||
} | ||
|
||
public static async testForPreDeploymentStepsWithSlotEnabled() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeployToSlotOrASEFlag = true; | ||
taskParameters.ResourceGroupName = "MOCK_RESOURCE_GROUP_NAME"; | ||
var azureRmWebAppDeploymentProvider : AzureRmWebAppDeploymentProvider = new AzureRmWebAppDeploymentProvider(taskParameters); | ||
await azureRmWebAppDeploymentProvider.PreDeploymentStep(); | ||
tl.setResult(tl.TaskResult.Succeeded, 'PreDeployment steps with slot enabled should succeeded'); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'PreDeployment steps with slot enabled failed with error'); | ||
} | ||
} | ||
|
||
public static async testForVirtualApplication() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeployToSlotOrASEFlag = true; | ||
taskParameters.ResourceGroupName = "MOCK_RESOURCE_GROUP_NAME"; | ||
taskParameters.VirtualApplication = "VirtualApplication"; | ||
var azureRmWebAppDeploymentProvider : AzureRmWebAppDeploymentProvider = new AzureRmWebAppDeploymentProvider(taskParameters); | ||
await azureRmWebAppDeploymentProvider.PreDeploymentStep(); | ||
tl.setResult(tl.TaskResult.Succeeded, 'PreDeployment steps with virtual application should succeeded'); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'PreDeployment steps with virtual application failed with error'); | ||
} | ||
} | ||
|
||
public static async testForUpdateDeploymentStatus() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
var azureRmWebAppDeploymentProvider : AzureRmWebAppDeploymentProvider = new AzureRmWebAppDeploymentProvider(taskParameters); | ||
await azureRmWebAppDeploymentProvider.PreDeploymentStep(); | ||
await azureRmWebAppDeploymentProvider.UpdateDeploymentStatus(true); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'UpdateDeploymentStatus steps should succeeded but failed with error'); | ||
} | ||
} | ||
|
||
} | ||
|
||
AzureRmWebAppDeploymentProviderL0Tests.startAzureRmWebAppDeploymentProviderL0Tests(); |
41 changes: 41 additions & 0 deletions
41
Tasks/AzureRmWebAppDeploymentV5/Tests/AzureRmWebAppDeploymentProviderTests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import tl = require('azure-pipelines-task-lib'); | ||
import tmrm = require('azure-pipelines-task-lib/mock-run'); | ||
import ma = require('azure-pipelines-task-lib/mock-answer'); | ||
import * as path from 'path'; | ||
import { setEndpointData, setAgentsData, mockTaskArgument, mockTaskInputParameters } from './utils'; | ||
|
||
export class AzureRmWebAppDeploymentProviderTests { | ||
|
||
public static startAzureRmWebAppDeploymentProviderTests(){ | ||
let tp = path.join(__dirname, 'AzureRmWebAppDeploymentProviderL0Tests.js'); | ||
let tr : tmrm.TaskMockRunner = new tmrm.TaskMockRunner(tp); | ||
mockTaskInputParameters(tr); | ||
setEndpointData(); | ||
setAgentsData(); | ||
|
||
const kudu = { | ||
updateDeployment : function(_) { | ||
return "MOCK_DEPLOYMENT_ID"; | ||
} | ||
}; | ||
|
||
const utility = { | ||
getKuduService: function() | ||
{ | ||
return Promise.resolve(kudu); | ||
} | ||
}; | ||
|
||
tr.registerMock('azure-pipelines-tasks-azure-arm-rest/azureAppServiceUtility', { | ||
AzureAppServiceUtility: function(_) { | ||
return utility; | ||
} | ||
}); | ||
|
||
tr.setAnswers(mockTaskArgument()); | ||
tr.run(); | ||
} | ||
|
||
} | ||
|
||
AzureRmWebAppDeploymentProviderTests.startAzureRmWebAppDeploymentProviderTests(); |
122 changes: 122 additions & 0 deletions
122
Tasks/AzureRmWebAppDeploymentV5/Tests/BuiltInLinuxWebAppDeploymentProviderL0Tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import tl = require('azure-pipelines-task-lib'); | ||
import { BuiltInLinuxWebAppDeploymentProvider } from '../deploymentProvider/BuiltInLinuxWebAppDeploymentProvider' | ||
import { TaskParametersUtility, TaskParameters, DeploymentTypeLinux } from '../operations/TaskParameters'; | ||
import { PackageType } from 'azure-pipelines-tasks-webdeployment-common/packageUtility'; | ||
import { getMockEndpoint } from '../node_modules/azure-pipelines-tasks-azure-arm-rest/Tests/mock_utils'; | ||
import { mockAzureARMPreDeploymentSteps, mockLinuxAppSettings } from "./mock_utils"; | ||
|
||
getMockEndpoint(); | ||
mockAzureARMPreDeploymentSteps(); | ||
mockLinuxAppSettings(); | ||
|
||
export class BuiltInLinuxWebAppDeploymentProviderL0Tests { | ||
|
||
public static async startBuiltInLinuxWebAppDeploymentProviderL0Tests() { | ||
await BuiltInLinuxWebAppDeploymentProviderL0Tests.testForPreDeploymentSteps_BuiltInLinuxWebApp(); | ||
await BuiltInLinuxWebAppDeploymentProviderL0Tests.testForPreDeploymentStepsWithSlotEnabled_BuiltInLinuxWebApp(); | ||
await BuiltInLinuxWebAppDeploymentProviderL0Tests.testForUpdateDeploymentStatus_BuiltInLinuxWebApp(); | ||
await BuiltInLinuxWebAppDeploymentProviderL0Tests.testForDeployWebAppStep_BuiltInLinuxWebApp_ZipPackage(); | ||
await BuiltInLinuxWebAppDeploymentProviderL0Tests.testForDeployWebAppStep_BuiltInLinuxWebApp_FolderPackage(); | ||
await BuiltInLinuxWebAppDeploymentProviderL0Tests.testForDeployWebAppStep_BuiltInLinuxWebApp_WarPackage(); | ||
await BuiltInLinuxWebAppDeploymentProviderL0Tests.testForDeployWebAppStep_BuiltInLinuxWebApp_JarPackage(); | ||
} | ||
|
||
public static async testForPreDeploymentSteps_BuiltInLinuxWebApp() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeploymentTypeLinux = DeploymentTypeLinux.zipDeploy; | ||
var builtInLinuxWebAppDeploymentProvider : BuiltInLinuxWebAppDeploymentProvider = new BuiltInLinuxWebAppDeploymentProvider(taskParameters); | ||
await builtInLinuxWebAppDeploymentProvider.PreDeploymentStep(); | ||
tl.setResult(tl.TaskResult.Succeeded, 'PreDeployment steps for built in linux web app should succeeded'); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'PreDeployment steps for built in linux web app failed with error'); | ||
} | ||
} | ||
|
||
public static async testForPreDeploymentStepsWithSlotEnabled_BuiltInLinuxWebApp() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeploymentTypeLinux = DeploymentTypeLinux.zipDeploy; | ||
taskParameters.DeployToSlotOrASEFlag = true; | ||
taskParameters.ResourceGroupName = "MOCK_RESOURCE_GROUP_NAME"; | ||
var builtInLinuxWebAppDeploymentProvider : BuiltInLinuxWebAppDeploymentProvider = new BuiltInLinuxWebAppDeploymentProvider(taskParameters); | ||
await builtInLinuxWebAppDeploymentProvider.PreDeploymentStep(); | ||
tl.setResult(tl.TaskResult.Succeeded, 'PreDeployment steps for built in linux web app with slot enabled should succeeded'); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'PreDeployment steps for built in linux web app with slot enabled failed with error'); | ||
} | ||
} | ||
|
||
public static async testForUpdateDeploymentStatus_BuiltInLinuxWebApp() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeploymentTypeLinux = DeploymentTypeLinux.zipDeploy; | ||
var builtInLinuxWebAppDeploymentProvider : BuiltInLinuxWebAppDeploymentProvider = new BuiltInLinuxWebAppDeploymentProvider(taskParameters); | ||
await builtInLinuxWebAppDeploymentProvider.PreDeploymentStep(); | ||
await builtInLinuxWebAppDeploymentProvider.UpdateDeploymentStatus(true); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'UpdateDeploymentStatus for built in linux web app steps should succeeded but failed with error'); | ||
} | ||
} | ||
|
||
public static async testForDeployWebAppStep_BuiltInLinuxWebApp_ZipPackage() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeploymentTypeLinux = DeploymentTypeLinux.zipDeploy; | ||
var builtInLinuxWebAppDeploymentProvider : BuiltInLinuxWebAppDeploymentProvider = new BuiltInLinuxWebAppDeploymentProvider(taskParameters); | ||
await builtInLinuxWebAppDeploymentProvider.PreDeploymentStep(); | ||
await builtInLinuxWebAppDeploymentProvider.DeployWebAppStep(); | ||
tl.setResult(tl.TaskResult.Succeeded, 'DeployWebAppStep for built in linux web app steps with zip package succeeded'); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'DeployWebAppStep for built in linux web app steps with zip package should succeeded but failed with error'); | ||
} | ||
} | ||
|
||
public static async testForDeployWebAppStep_BuiltInLinuxWebApp_FolderPackage() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeploymentTypeLinux = DeploymentTypeLinux.zipDeploy; | ||
taskParameters.Package.getPackageType = () :PackageType => {return PackageType.folder}; | ||
taskParameters.Package.getPath = () :string => { return "webAppPkg" }; | ||
var builtInLinuxWebAppDeploymentProvider : BuiltInLinuxWebAppDeploymentProvider = new BuiltInLinuxWebAppDeploymentProvider(taskParameters); | ||
await builtInLinuxWebAppDeploymentProvider.PreDeploymentStep(); | ||
await builtInLinuxWebAppDeploymentProvider.DeployWebAppStep(); | ||
tl.setResult(tl.TaskResult.Succeeded, 'DeployWebAppStep for built in linux web app steps with folder package succeeded'); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'DeployWebAppStep for built in linux web app steps with folder package should succeeded but failed with error'); | ||
} | ||
} | ||
|
||
public static async testForDeployWebAppStep_BuiltInLinuxWebApp_WarPackage() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeploymentTypeLinux = DeploymentTypeLinux.zipDeploy; | ||
taskParameters.Package.getPackageType = () :PackageType => {return PackageType.war}; | ||
taskParameters.Package.getPath = () :string => { return "webAppPkg.war" }; | ||
var builtInLinuxWebAppDeploymentProvider : BuiltInLinuxWebAppDeploymentProvider = new BuiltInLinuxWebAppDeploymentProvider(taskParameters); | ||
await builtInLinuxWebAppDeploymentProvider.PreDeploymentStep(); | ||
await builtInLinuxWebAppDeploymentProvider.DeployWebAppStep(); | ||
tl.setResult(tl.TaskResult.Succeeded, 'DeployWebAppStep for built in linux web app steps with war package succeeded'); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'DeployWebAppStep for built in linux web app steps with war package should succeeded but failed with error'); | ||
} | ||
} | ||
|
||
public static async testForDeployWebAppStep_BuiltInLinuxWebApp_JarPackage() { | ||
try { | ||
var taskParameters: TaskParameters = TaskParametersUtility.getParameters(); | ||
taskParameters.DeploymentTypeLinux = DeploymentTypeLinux.zipDeploy; | ||
taskParameters.Package.getPackageType = () :PackageType => {return PackageType.jar}; | ||
taskParameters.Package.getPath = () :string => { return "webAppPkg.jar" }; | ||
var builtInLinuxWebAppDeploymentProvider : BuiltInLinuxWebAppDeploymentProvider = new BuiltInLinuxWebAppDeploymentProvider(taskParameters); | ||
await builtInLinuxWebAppDeploymentProvider.PreDeploymentStep(); | ||
await builtInLinuxWebAppDeploymentProvider.DeployWebAppStep(); | ||
tl.setResult(tl.TaskResult.Succeeded, 'DeployWebAppStep for built in linux web app steps with jar package succeeded'); | ||
} catch(error) { | ||
tl.setResult(tl.TaskResult.Failed, 'DeployWebAppStep for built in linux web app steps with jar package should succeeded but failed with error'); | ||
} | ||
} | ||
|
||
} | ||
|
||
BuiltInLinuxWebAppDeploymentProviderL0Tests.startBuiltInLinuxWebAppDeploymentProviderL0Tests(); |
80 changes: 80 additions & 0 deletions
80
Tasks/AzureRmWebAppDeploymentV5/Tests/BuiltInLinuxWebAppDeploymentProviderTests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import tmrm = require('azure-pipelines-task-lib/mock-run'); | ||
import * as path from 'path'; | ||
import { setEndpointData, setAgentsData, mockTaskArgument, mockTaskInputParameters } from './utils'; | ||
|
||
export class BuiltInLinuxWebAppDeploymentProviderTests { | ||
|
||
public static startBuiltInLinuxWebAppDeploymentProviderTests(){ | ||
let tp = path.join(__dirname, 'BuiltInLinuxWebAppDeploymentProviderL0Tests.js'); | ||
let tr : tmrm.TaskMockRunner = new tmrm.TaskMockRunner(tp); | ||
mockTaskInputParameters(tr); | ||
setEndpointData(); | ||
setAgentsData(); | ||
|
||
|
||
const kudu = { | ||
updateDeployment : function(D) { | ||
return "MOCK_DEPLOYMENT_ID"; | ||
}, | ||
getAppSettings : function() { | ||
var map: Map<string, string> = new Map<string, string>(); | ||
map.set('MSDEPLOY_RENAME_LOCKED_FILES', '1'); | ||
map.set('ScmType', 'ScmType'); | ||
return map; | ||
}, | ||
zipDeploy: function(E, F) { | ||
return '{id: "ZIP_DEPLOY_FAILED_ID", status: 3, deployer: "VSTS_ZIP_DEPLOY", author: "VSTS USER"}'; | ||
}, | ||
warDeploy: function(G, H) { | ||
return '{id: "ZIP_DEPLOY_FAILED_ID", status: 3, deployer: "VSTS_ZIP_DEPLOY", author: "VSTS USER"}'; | ||
}, | ||
getDeploymentDetails: function(I) { | ||
return "{ type: 'Deployment',url: 'http://MOCK_SCM_WEBSITE/api/deployments/MOCK_DEPLOYMENT_ID'}"; | ||
} | ||
}; | ||
|
||
const utility = { | ||
getKuduService: function() | ||
{ | ||
return Promise.resolve(kudu); | ||
} | ||
}; | ||
|
||
tr.registerMock('azure-pipelines-tasks-azure-arm-rest/azureAppServiceUtility', { | ||
AzureAppServiceUtility: function(_) { | ||
return utility; | ||
} | ||
}); | ||
|
||
tr.registerMock('azure-pipelines-tasks-webdeployment-common/utility.js', { | ||
generateTemporaryFolderForDeployment: function () { | ||
return "webAppPkg"; | ||
}, | ||
archiveFolderForDeployment: function() { | ||
return { | ||
"webDeployPkg": "webAppPkg", | ||
"tempPackagePath": "webAppPkg" | ||
}; | ||
}, | ||
getFileNameFromPath: function(A, B) { | ||
return "webAppPkg"; | ||
}, | ||
generateTemporaryFolderOrZipPath: function(C, D) { | ||
return "webAppPkg.zip"; | ||
} | ||
}); | ||
|
||
tr.registerMock('azure-pipelines-tasks-webdeployment-common/ziputility.js', { | ||
archiveFolder: function(A, B){ | ||
return "webAppPkg.zip"; | ||
} | ||
}); | ||
|
||
tr.setAnswers(mockTaskArgument()); | ||
tr.run(); | ||
} | ||
|
||
|
||
} | ||
|
||
BuiltInLinuxWebAppDeploymentProviderTests.startBuiltInLinuxWebAppDeploymentProviderTests(); |
Oops, something went wrong.