Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 10 upgrade for IIS webapp deploy task #14603

Merged
merged 16 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions Tasks/IISWebAppDeploymentOnMachineGroupV0/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ describe('IISWebsiteDeploymentOnMachineGroup test suite', function() {
var taskSrcPath = path.join(__dirname, '..','deployiiswebapp.js');

before((done) => {
tl.cp(path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'Web.config'), path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'Web_test.config'), null, false);
tl.cp(path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'Web.Debug.config'), path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'Web_test.Debug.config'), null, false);
tl.cp(path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests", 'L1XdtTransform', 'Web.config'), path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests", 'L1XdtTransform', 'Web_test.config'), null, false);
tl.cp(path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'parameters.xml'), path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'parameters_test.xml'), null, false);
tl.cp(path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'Web.config'), path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'Web_test.config'), null, false);
tl.cp(path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'Web.Debug.config'), path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'Web_test.Debug.config'), null, false);
tl.cp(path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests", 'L1XdtTransform', 'Web.config'), path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests", 'L1XdtTransform', 'Web_test.config'), null, false);
tl.cp(path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'parameters.xml'), path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'parameters_test.xml'), null, false);
done();
});
after(function() {
tl.rmRF(path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests", 'L1XdtTransform', 'Web_test.config'));
tl.rmRF(path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'Web_test.config'));
tl.rmRF(path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'Web_Test.Debug.config'));
tl.rmRF(path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'parameters_test.xml'));
tl.rmRF(path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests", 'L1XdtTransform', 'Web_test.config'));
tl.rmRF(path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'Web_test.config'));
tl.rmRF(path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'Web_Test.Debug.config'));
tl.rmRF(path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'parameters_test.xml'));
});

if(!tl.osType().match(/^Win/)) {
Expand Down Expand Up @@ -148,13 +148,13 @@ describe('IISWebsiteDeploymentOnMachineGroup test suite', function() {
it('Runs successfully with XDT Transformation (L1)', (done:MochaDone) => {
this.timeout(parseInt(process.env.TASK_TEST_TIMEOUT) || 20000);

let tp = path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests","L1XdtTransform.js");
let tp = path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests","L1XdtTransform.js");
let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();

if(tl.osType().match(/^Win/)) {
var resultFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests", 'L1XdtTransform', 'Web_test.config')));
var expectFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests", 'L1XdtTransform','Web_Expected.config')));
var resultFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests", 'L1XdtTransform', 'Web_test.config')));
var expectFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests", 'L1XdtTransform','Web_Expected.config')));
assert(ltx.equal(resultFile, expectFile) , 'Should Transform attributes on Web.config');
}
else {
Expand All @@ -165,21 +165,21 @@ describe('IISWebsiteDeploymentOnMachineGroup test suite', function() {


it('Runs successfully with XML variable substitution', (done:MochaDone) => {
let tp = path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub.js');
let tp = path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub.js');
let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();

var resultFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests", 'L1XmlVarSub', 'Web_test.config')));
var expectFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests", 'L1XmlVarSub', 'Web_Expected.config')));
var resultFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests", 'L1XmlVarSub', 'Web_test.config')));
var expectFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests", 'L1XmlVarSub', 'Web_Expected.config')));
assert(ltx.equal(resultFile, expectFile) , 'Should have substituted variables in Web.config file');
var resultFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'Web_test.Debug.config')));
var expectFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1XmlVarSub', 'Web_Expected.Debug.config')));
var resultFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'Web_test.Debug.config')));
var expectFile = ltx.parse(fs.readFileSync(path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1XmlVarSub', 'Web_Expected.Debug.config')));
assert(ltx.equal(resultFile, expectFile) , 'Should have substituted variables in Web.Debug.config file');
done();
});

it('Runs successfully with JSON variable substitution', (done:MochaDone) => {
let tp = path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1JsonVarSub.js');
let tp = path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1JsonVarSub.js');
let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();

Expand All @@ -196,7 +196,7 @@ describe('IISWebsiteDeploymentOnMachineGroup test suite', function() {
});

it('Validate File Encoding', (done:MochaDone) => {
let tp = path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L1ValidateFileEncoding.js');
let tp = path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L1ValidateFileEncoding.js');
let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();

Expand All @@ -217,8 +217,8 @@ describe('IISWebsiteDeploymentOnMachineGroup test suite', function() {
done();
});

it('Validate webdeployment-common-v2.utility.copyDirectory()', (done:MochaDone) => {
let tp = path.join(__dirname, "..", "node_modules", "webdeployment-common-v2", "Tests", 'L0CopyDirectory.js');
it('Validate azure-pipelines-tasks-webdeployment-common.utility.copyDirectory()', (done:MochaDone) => {
let tp = path.join(__dirname, "..", "node_modules", "azure-pipelines-tasks-webdeployment-common", "Tests", 'L0CopyDirectory.js');
let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();

Expand All @@ -228,7 +228,7 @@ describe('IISWebsiteDeploymentOnMachineGroup test suite', function() {
});

it('Validate MSDeploy parameters', (done:MochaDone) => {
let tp = path.join(__dirname, "..", "node_modules","webdeployment-common-v2","Tests","L0MSDeployUtility.js");
let tp = path.join(__dirname, "..", "node_modules","azure-pipelines-tasks-webdeployment-common","Tests","L0MSDeployUtility.js");
let tr : ttm.MockTestRunner = new ttm.MockTestRunner(tp);
tr.run();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
}

import mockTask = require('azure-pipelines-task-lib/mock-task');
var msDeployUtility = require('webdeployment-common-v2/msdeployutility.js');
tr.registerMock('webdeployment-common-v2/ziputility.js', {
var msDeployUtility = require('azure-pipelines-tasks-webdeployment-common/msdeployutility.js');
tr.registerMock('azure-pipelines-tasks-webdeployment-common/ziputility.js', {
getArchivedEntries: function(webDeployPkg) {
return {
"entries": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
};

import mockTask = require('azure-pipelines-task-lib/mock-task');
var msDeployUtility = require('webdeployment-common-v2/msdeployutility.js');
tr.registerMock('webdeployment-common-v2/ziputility.js', {
var msDeployUtility = require('azure-pipelines-tasks-webdeployment-common/msdeployutility.js');
tr.registerMock('azure-pipelines-tasks-webdeployment-common/ziputility.js', {
getArchivedEntries: function(webDeployPkg) {
return {
"entries": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ let a: any = <any>{
};

import mockTask = require('azure-pipelines-task-lib/mock-task');
var msDeployUtility = require('webdeployment-common-v2/msdeployutility.js');
tr.registerMock('webdeployment-common-v2/ziputility.js', {
var msDeployUtility = require('azure-pipelines-tasks-webdeployment-common/msdeployutility.js');
tr.registerMock('azure-pipelines-tasks-webdeployment-common/ziputility.js', {
getArchivedEntries: function(webDeployPkg) {
return {
"entries": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers> {
};

import mockTask = require('azure-pipelines-task-lib/mock-task');
var msDeployUtility = require('webdeployment-common-v2/msdeployutility.js');
var msDeployUtility = require('azure-pipelines-tasks-webdeployment-common/msdeployutility.js');

var fs = require('fs');
tr.registerMock('fs', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers> {
};

import mockTask = require('azure-pipelines-task-lib/mock-task');
var msDeployUtility = require('webdeployment-common-v2/msdeployutility.js');
var msDeployUtility = require('azure-pipelines-tasks-webdeployment-common/msdeployutility.js');

tr.registerMock('webdeployment-common-v2/ziputility.js', {
tr.registerMock('azure-pipelines-tasks-webdeployment-common/ziputility.js', {
getArchivedEntries: function(webDeployPkg) {
return {
"entries": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ tr.setInput('WebSiteName', 'mytestwebsite');
tr.setInput('Package', 'webAppPkg.zip');
tr.setInput('XmlTransformation', 'true');

process.env['TASK_TEST_TRACE'] = 1;
process.env['TASK_TEST_TRACE'] = "1";
process.env["SYSTEM_DEFAULTWORKINGDIRECTORY"] = "DefaultWorkingDirectory";
process.env['SYSTEM_DEBUG'] = false;
process.env['SYSTEM_DEBUG'] = "false";

// provide answers for task mock
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
Expand Down Expand Up @@ -86,7 +86,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{

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

var msDeployUtility = require('webdeployment-common-v2/msdeployutility.js');
var msDeployUtility = require('azure-pipelines-tasks-webdeployment-common/msdeployutility.js');

tr.registerMock('./msdeployutility.js', {
getMSDeployCmdArgs : msDeployUtility.getMSDeployCmdArgs,
Expand All @@ -96,7 +96,7 @@ tr.registerMock('./msdeployutility.js', {
}
});

tr.registerMock('webdeployment-common-v2/ziputility.js', {
tr.registerMock('azure-pipelines-tasks-webdeployment-common/ziputility.js', {
getArchivedEntries: function(webDeployPkg) {
return {
"entries": [
Expand All @@ -107,7 +107,7 @@ tr.registerMock('webdeployment-common-v2/ziputility.js', {
}
});

tr.registerMock('webdeployment-common-v2/utility.js', {
tr.registerMock('azure-pipelines-tasks-webdeployment-common/utility.js', {
isInputPkgIsFolder: function() {
return false;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ tr.setInput('WebSiteName', 'mytestwebsite');
tr.setInput('Package', 'webAppPkg.zip');
tr.setInput('XmlTransformation', 'true');

process.env['TASK_TEST_TRACE'] = 1;
process.env['TASK_TEST_TRACE'] = "1";
process.env["SYSTEM_DEFAULTWORKINGDIRECTORY"] = "DefaultWorkingDirectory";
process.env['SYSTEM_DEBUG'] = true;
process.env['SYSTEM_DEBUG'] = "true";

// provide answers for task mock
let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{
Expand Down Expand Up @@ -86,7 +86,7 @@ let a: ma.TaskLibAnswers = <ma.TaskLibAnswers>{

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

var msDeployUtility = require('webdeployment-common-v2/msdeployutility.js');
var msDeployUtility = require('azure-pipelines-tasks-webdeployment-common/msdeployutility.js');
tr.registerMock('./msdeployutility.js', {
getMSDeployCmdArgs : msDeployUtility.getMSDeployCmdArgs,
getMSDeployFullPath : function() {
Expand All @@ -95,7 +95,7 @@ tr.registerMock('./msdeployutility.js', {
}
});

tr.registerMock('webdeployment-common-v2/utility.js', {
tr.registerMock('azure-pipelines-tasks-webdeployment-common/utility.js', {
isInputPkgIsFolder: function() {
return false;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import path = require('path');
import fs = require('fs');

var msDeploy = require('webdeployment-common-v2/deployusingmsdeploy.js');
var utility = require('webdeployment-common-v2/utility.js');
var fileTransformationsUtility = require('webdeployment-common-v2/fileTransformationsUtility.js');
var msDeploy = require('azure-pipelines-tasks-webdeployment-common/deployusingmsdeploy.js');
var utility = require('azure-pipelines-tasks-webdeployment-common/utility.js');
var fileTransformationsUtility = require('azure-pipelines-tasks-webdeployment-common/fileTransformationsUtility.js');

async function run()
{
try
{
tl.setResourcePath(path.join( __dirname, 'task.json'));
tl.setResourcePath(path.join( __dirname, 'node_modules/webdeployment-common-v2/module.json'));
tl.setResourcePath(path.join( __dirname, 'node_modules/azure-pipelines-tasks-webdeployment-common/module.json'));
var webSiteName: string = tl.getInput('WebSiteName', true);
var virtualApplication: string = tl.getInput('VirtualApplication', false);
var webDeployPkg: string = tl.getPathInput('Package', true);
Expand Down
8 changes: 0 additions & 8 deletions Tasks/IISWebAppDeploymentOnMachineGroupV0/make.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"common": [
{
"module": "../Common/webdeployment-common-v2",
"type": "node",
"dest": "./",
"compile" : true
}
],
"externals": {
"archivePackages": [
{
Expand Down
Loading