azure-pipelines-tasks-webdeployment-common 4.230.3 → 4.230.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/7zip/7zip/7z.dll +0 -0
- package/7zip/7zip/7z.exe +0 -0
- package/7zip/7zip/License.txt +49 -15
- package/Strings/resources.resjson/en-US/resources.resjson +4 -1
- package/deployusingmsdeploy.js +42 -37
- package/module.json +3 -4
- package/msdeployutility.d.ts +3 -0
- package/msdeployutility.js +74 -77
- package/package.json +7 -4
package/7zip/7zip/7z.dll
CHANGED
|
Binary file
|
package/7zip/7zip/7z.exe
CHANGED
|
Binary file
|
package/7zip/7zip/License.txt
CHANGED
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
License for use and distribution
|
|
4
4
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
5
5
|
|
|
6
|
-
7-Zip Copyright (C) 1999-
|
|
6
|
+
7-Zip Copyright (C) 1999-2019 Igor Pavlov.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
The licenses for files are:
|
|
9
9
|
|
|
10
|
-
1) 7z.dll:
|
|
11
|
-
|
|
10
|
+
1) 7z.dll:
|
|
11
|
+
- The "GNU LGPL" as main license for most of the code
|
|
12
|
+
- The "GNU LGPL" with "unRAR license restriction" for some code
|
|
13
|
+
- The "BSD 3-clause License" for some code
|
|
14
|
+
2) All other files: the "GNU LGPL".
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
GNU LGPL rules and unRAR restriction rules.
|
|
16
|
+
Redistributions in binary form must reproduce related license information from this file.
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
You can use 7-Zip on any computer, including a computer in a commercial
|
|
18
|
+
Note:
|
|
19
|
+
You can use 7-Zip on any computer, including a computer in a commercial
|
|
19
20
|
organization. You don't need to register or pay for 7-Zip.
|
|
20
21
|
|
|
21
22
|
|
|
@@ -32,21 +33,54 @@
|
|
|
32
33
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
33
34
|
Lesser General Public License for more details.
|
|
34
35
|
|
|
35
|
-
You can receive a copy of the GNU Lesser General Public License from
|
|
36
|
+
You can receive a copy of the GNU Lesser General Public License from
|
|
36
37
|
http://www.gnu.org/
|
|
37
38
|
|
|
38
39
|
|
|
39
|
-
unRAR restriction
|
|
40
|
-
-----------------
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
|
|
42
|
+
BSD 3-clause License
|
|
43
|
+
--------------------
|
|
44
|
+
|
|
45
|
+
The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression.
|
|
46
|
+
That code was derived from the code in the "LZFSE compression library" developed by Apple Inc,
|
|
47
|
+
that also uses the "BSD 3-clause License":
|
|
48
|
+
|
|
49
|
+
----
|
|
50
|
+
Copyright (c) 2015-2016, Apple Inc. All rights reserved.
|
|
51
|
+
|
|
52
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
53
|
+
|
|
54
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
55
|
+
|
|
56
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
|
|
57
|
+
in the documentation and/or other materials provided with the distribution.
|
|
58
|
+
|
|
59
|
+
3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived
|
|
60
|
+
from this software without specific prior written permission.
|
|
61
|
+
|
|
62
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
63
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
64
|
+
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
65
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
66
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
67
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
68
|
+
----
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
unRAR license restriction
|
|
74
|
+
-------------------------
|
|
75
|
+
|
|
76
|
+
The decompression engine for RAR archives was developed using source
|
|
43
77
|
code of unRAR program.
|
|
44
78
|
All copyrights to original unRAR code are owned by Alexander Roshal.
|
|
45
79
|
|
|
46
80
|
The license for original unRAR code has the following restriction:
|
|
47
81
|
|
|
48
|
-
The unRAR sources cannot be used to re-create the RAR compression algorithm,
|
|
49
|
-
which is proprietary. Distribution of modified unRAR sources in separate form
|
|
82
|
+
The unRAR sources cannot be used to re-create the RAR compression algorithm,
|
|
83
|
+
which is proprietary. Distribution of modified unRAR sources in separate form
|
|
50
84
|
or as a part of other software is permitted, provided that it is clearly
|
|
51
85
|
stated in the documentation and source comments that the code may
|
|
52
86
|
not be used to develop a RAR (WinRAR) compatible archiver.
|
|
@@ -29,5 +29,8 @@
|
|
|
29
29
|
"loc.messages.VariableSubstitutionInitiated": "Initiated variable substitution in config file : %s",
|
|
30
30
|
"loc.messages.ConfigFileUpdated": "Config file : %s updated.",
|
|
31
31
|
"loc.messages.SkippedUpdatingFile": "Skipped Updating file: %s",
|
|
32
|
-
"loc.messages.PwshNotAvailable": "##WARNING##:PowerShell Core (pwsh.exe) is not available on agent machine. Falling back to using Windows PowerShell (powershell.exe). This can cause reduced performance. Please install the newer version of PowerShell for improved performance."
|
|
32
|
+
"loc.messages.PwshNotAvailable": "##WARNING##:PowerShell Core (pwsh.exe) is not available on agent machine. Falling back to using Windows PowerShell (powershell.exe). This can cause reduced performance. Please install the newer version of PowerShell for improved performance.",
|
|
33
|
+
"loc.messages.UnabletofindthelocationofMSDeployfromregistryonmachineError": "Unable to find the location of MSDeploy from registry. Error: %s",
|
|
34
|
+
"loc.messages.MissingMSDeployInstallPathRegistryKey": "Missing MSDeploy InstallPath registry key.",
|
|
35
|
+
"loc.messages.UnsupportedinstalledversionfoundforMSDeployversionshouldbeatleast3orabove": "Unsupported installed version: %s found for MSDeploy. Version should be at least 3 or above."
|
|
33
36
|
}
|
package/deployusingmsdeploy.js
CHANGED
|
@@ -13,10 +13,8 @@ exports.executeWebDeploy = exports.DeployUsingMSDeploy = void 0;
|
|
|
13
13
|
const tl = require("azure-pipelines-task-lib/task");
|
|
14
14
|
const fs = require("fs");
|
|
15
15
|
const path = require("path");
|
|
16
|
-
const
|
|
16
|
+
const utility_1 = require("./utility");
|
|
17
17
|
const msdeployutility_1 = require("./msdeployutility");
|
|
18
|
-
var msDeployUtility = require('./msdeployutility.js');
|
|
19
|
-
var utility = require('./utility.js');
|
|
20
18
|
const DEFAULT_RETRY_COUNT = 3;
|
|
21
19
|
/**
|
|
22
20
|
* Executes Web Deploy command
|
|
@@ -34,17 +32,17 @@ const DEFAULT_RETRY_COUNT = 3;
|
|
|
34
32
|
*/
|
|
35
33
|
function DeployUsingMSDeploy(webDeployPkg, webAppName, publishingProfile, removeAdditionalFilesFlag, excludeFilesFromAppDataFlag, takeAppOfflineFlag, virtualApplication, setParametersFile, additionalArguments, isFolderBasedDeployment, useWebDeploy, authType) {
|
|
36
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
var msDeployPath = yield
|
|
35
|
+
var msDeployPath = yield msdeployutility_1.getMSDeployFullPath();
|
|
38
36
|
var msDeployDirectory = msDeployPath.slice(0, msDeployPath.lastIndexOf('\\') + 1);
|
|
39
37
|
var pathVar = process.env.PATH;
|
|
40
38
|
process.env.PATH = msDeployDirectory + ";" + process.env.PATH;
|
|
41
|
-
setParametersFile =
|
|
39
|
+
setParametersFile = utility_1.copySetParamFileIfItExists(setParametersFile);
|
|
42
40
|
var setParametersFileName = null;
|
|
43
41
|
if (setParametersFile != null) {
|
|
44
42
|
setParametersFileName = setParametersFile.slice(setParametersFile.lastIndexOf('\\') + 1, setParametersFile.length);
|
|
45
43
|
}
|
|
46
|
-
var isParamFilePresentInPackage = isFolderBasedDeployment ? false : yield
|
|
47
|
-
var msDeployCmdArgs =
|
|
44
|
+
var isParamFilePresentInPackage = isFolderBasedDeployment ? false : yield utility_1.isMSDeployPackage(webDeployPkg);
|
|
45
|
+
var msDeployCmdArgs = msdeployutility_1.getMSDeployCmdArgs(webDeployPkg, webAppName, publishingProfile, removeAdditionalFilesFlag, excludeFilesFromAppDataFlag, takeAppOfflineFlag, virtualApplication, setParametersFileName, additionalArguments, isParamFilePresentInPackage, isFolderBasedDeployment, useWebDeploy, authType);
|
|
48
46
|
var retryCountParam = tl.getVariable("appservice.msdeployretrycount");
|
|
49
47
|
var retryCount = (retryCountParam && !(isNaN(Number(retryCountParam)))) ? Number(retryCountParam) : DEFAULT_RETRY_COUNT;
|
|
50
48
|
try {
|
|
@@ -69,7 +67,7 @@ function DeployUsingMSDeploy(webDeployPkg, webAppName, publishingProfile, remove
|
|
|
69
67
|
catch (error) {
|
|
70
68
|
tl.error(tl.loc('PackageDeploymentFailed'));
|
|
71
69
|
tl.debug(JSON.stringify(error));
|
|
72
|
-
|
|
70
|
+
msdeployutility_1.redirectMSDeployErrorToConsole();
|
|
73
71
|
throw Error(error.message);
|
|
74
72
|
}
|
|
75
73
|
finally {
|
|
@@ -95,6 +93,7 @@ function executeWebDeploy(webDeployArguments) {
|
|
|
95
93
|
};
|
|
96
94
|
}
|
|
97
95
|
catch (exception) {
|
|
96
|
+
tl.debug(JSON.stringify(exception));
|
|
98
97
|
const msDeployErrorFilePath = tl.getVariable('System.DefaultWorkingDirectory') + '\\' + 'error.txt';
|
|
99
98
|
const errorFileContent = tl.exist(msDeployErrorFilePath) ? fs.readFileSync(msDeployErrorFilePath, 'utf-8') : "";
|
|
100
99
|
return {
|
|
@@ -158,36 +157,42 @@ function argStringToArray(argString) {
|
|
|
158
157
|
}
|
|
159
158
|
function executeMSDeploy(msDeployCmdArgs) {
|
|
160
159
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const errorFile = path.join(tl.getVariable('System.DefaultWorkingDirectory'), msdeployutility_1.ERROR_FILE_NAME);
|
|
162
|
+
const fd = fs.openSync(errorFile, "w");
|
|
163
|
+
const errorStream = fs.createWriteStream("", { fd: fd });
|
|
164
|
+
let msDeployError = null;
|
|
165
|
+
errorStream.on('finish', () => __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
if (msDeployError) {
|
|
167
|
+
reject(msDeployError);
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
try {
|
|
171
|
+
tl.debug("the argument string is:");
|
|
172
|
+
tl.debug(msDeployCmdArgs);
|
|
173
|
+
tl.debug("converting the argument string into an array of arguments");
|
|
174
|
+
const msDeployCmdArgsArray = argStringToArray(msDeployCmdArgs);
|
|
175
|
+
tl.debug("the array of arguments is:");
|
|
176
|
+
for (let i = 0; i < msDeployCmdArgsArray.length; i++) {
|
|
177
|
+
tl.debug("arg#" + i + ": " + msDeployCmdArgsArray[i]);
|
|
178
|
+
}
|
|
179
|
+
// set shell: true because C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe has folder with spaces
|
|
180
|
+
// see https://github.com/microsoft/azure-pipelines-tasks/issues/17634
|
|
181
|
+
const options = {
|
|
182
|
+
failOnStdErr: true,
|
|
183
|
+
errStream: errorStream,
|
|
184
|
+
windowsVerbatimArguments: true,
|
|
185
|
+
shell: true
|
|
186
|
+
};
|
|
187
|
+
yield tl.exec("msdeploy", msDeployCmdArgsArray, options);
|
|
188
|
+
resolve("Azure App service successfully deployed");
|
|
169
189
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
tl.debug("the argument string is:");
|
|
173
|
-
tl.debug(msDeployCmdArgs);
|
|
174
|
-
tl.debug("converting the argument string into an array of arguments");
|
|
175
|
-
msDeployCmdArgs = argStringToArray(msDeployCmdArgs);
|
|
176
|
-
tl.debug("the array of arguments is:");
|
|
177
|
-
for (var i = 0; i < msDeployCmdArgs.length; i++) {
|
|
178
|
-
tl.debug("arg#" + i + ": " + msDeployCmdArgs[i]);
|
|
190
|
+
catch (error) {
|
|
191
|
+
msDeployError = error;
|
|
179
192
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
msDeployError = error;
|
|
187
|
-
}
|
|
188
|
-
finally {
|
|
189
|
-
errObj.end();
|
|
190
|
-
}
|
|
191
|
-
return deferred.promise;
|
|
193
|
+
finally {
|
|
194
|
+
errorStream.end();
|
|
195
|
+
}
|
|
196
|
+
}));
|
|
192
197
|
});
|
|
193
198
|
}
|
package/module.json
CHANGED
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
"SkippedUpdatingFile" : "Skipped Updating file: %s",
|
|
33
33
|
"PwshNotAvailable": "##WARNING##:PowerShell Core (pwsh.exe) is not available on agent machine. Falling back to using Windows PowerShell (powershell.exe). This can cause reduced performance. Please install the newer version of PowerShell for improved performance.",
|
|
34
34
|
"UnabletofindthelocationofMSDeployfromregistryonmachineError": "Unable to find the location of MSDeploy from registry. Error: %s",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
}
|
|
35
|
+
"MissingMSDeployInstallPathRegistryKey": "Missing MSDeploy InstallPath registry key.",
|
|
36
|
+
"UnsupportedinstalledversionfoundforMSDeployversionshouldbeatleast3orabove": "Unsupported installed version: %s found for MSDeploy. Version should be at least 3 or above."
|
|
37
|
+
}
|
|
39
38
|
}
|
package/msdeployutility.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Package } from './packageUtility';
|
|
2
|
+
export declare const ERROR_FILE_NAME = "error.txt";
|
|
2
3
|
/**
|
|
3
4
|
* Constructs argument for MSDeploy command
|
|
4
5
|
*
|
|
@@ -26,6 +27,8 @@ export declare function shouldUseMSDeployTokenAuth(): boolean;
|
|
|
26
27
|
* @returns string
|
|
27
28
|
*/
|
|
28
29
|
export declare function getMSDeployFullPath(): Promise<string>;
|
|
30
|
+
export declare function getInstalledMSDeployVersion(): Promise<string>;
|
|
31
|
+
export declare function installedMSDeployVersionSupportsTokenAuth(): Promise<boolean | undefined>;
|
|
29
32
|
/**
|
|
30
33
|
* 1. Checks if msdeploy during execution redirected any error to
|
|
31
34
|
* error stream ( saved in error.txt) , display error to console
|
package/msdeployutility.js
CHANGED
|
@@ -9,13 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.getWebDeployErrorCode = exports.redirectMSDeployErrorToConsole = exports.getMSDeployFullPath = exports.shouldUseMSDeployTokenAuth = exports.getWebDeployArgumentsString = exports.getMSDeployCmdArgs = void 0;
|
|
12
|
+
exports.getWebDeployErrorCode = exports.redirectMSDeployErrorToConsole = exports.installedMSDeployVersionSupportsTokenAuth = exports.getInstalledMSDeployVersion = exports.getMSDeployFullPath = exports.shouldUseMSDeployTokenAuth = exports.getWebDeployArgumentsString = exports.getMSDeployCmdArgs = exports.ERROR_FILE_NAME = void 0;
|
|
13
13
|
const tl = require("azure-pipelines-task-lib/task");
|
|
14
14
|
const fs = require("fs");
|
|
15
15
|
const path = require("path");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const winreg = require("winreg");
|
|
17
|
+
const semver = require("semver");
|
|
18
|
+
exports.ERROR_FILE_NAME = "error.txt";
|
|
19
19
|
/**
|
|
20
20
|
* Constructs argument for MSDeploy command
|
|
21
21
|
*
|
|
@@ -213,9 +213,8 @@ exports.shouldUseMSDeployTokenAuth = shouldUseMSDeployTokenAuth;
|
|
|
213
213
|
function getMSDeployFullPath() {
|
|
214
214
|
return __awaiter(this, void 0, void 0, function* () {
|
|
215
215
|
try {
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
return (yield getMSDeployInstallPath(msDeployLatestPathRegKey)) + "msdeploy.exe";
|
|
216
|
+
const msDeployFolder = yield getMSDeployInstallPath();
|
|
217
|
+
return path.join(msDeployFolder, "msdeploy.exe");
|
|
219
218
|
}
|
|
220
219
|
catch (error) {
|
|
221
220
|
tl.debug(error);
|
|
@@ -225,31 +224,84 @@ function getMSDeployFullPath() {
|
|
|
225
224
|
});
|
|
226
225
|
}
|
|
227
226
|
exports.getMSDeployFullPath = getMSDeployFullPath;
|
|
228
|
-
function
|
|
227
|
+
function getMSDeployInstallPath() {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
229
|
+
const regKey = yield getMSDeployLatestRegKey();
|
|
230
|
+
return new Promise((resolve, reject) => {
|
|
231
|
+
regKey.get("InstallPath", function (err, item) {
|
|
232
|
+
if (err) {
|
|
233
|
+
reject(tl.loc("MissingMSDeployInstallPathRegistryKey"));
|
|
234
|
+
}
|
|
235
|
+
resolve(item.value);
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
function getInstalledMSDeployVersion() {
|
|
241
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
242
|
+
let regKey;
|
|
243
|
+
try {
|
|
244
|
+
regKey = yield getMSDeployLatestRegKey();
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
tl.debug("An error occured while loading msdeploy registry values: " + err);
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
return new Promise((resolve, _) => {
|
|
251
|
+
regKey.get("Version", function (err, item) {
|
|
252
|
+
if (err) {
|
|
253
|
+
tl.debug("An error occured while loading msdeploy version from registry: " + err);
|
|
254
|
+
resolve(undefined);
|
|
255
|
+
}
|
|
256
|
+
const version = item.value;
|
|
257
|
+
tl.debug(`Installed MSDeploy Version: ${version}`);
|
|
258
|
+
resolve(version);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
exports.getInstalledMSDeployVersion = getInstalledMSDeployVersion;
|
|
264
|
+
function installedMSDeployVersionSupportsTokenAuth() {
|
|
265
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
266
|
+
// MSDeploy 9.0.7225 is the first product version to support token auth
|
|
267
|
+
const minimalMSDeployVersion = "9.0.7225";
|
|
268
|
+
const msDeployVersion = yield getInstalledMSDeployVersion();
|
|
269
|
+
if (!msDeployVersion) {
|
|
270
|
+
tl.debug('Could not determine MSDeploy version. Assuming it is not installed.');
|
|
271
|
+
return undefined;
|
|
272
|
+
}
|
|
273
|
+
return semver.gte(semver.coerce(msDeployVersion), semver.coerce(minimalMSDeployVersion));
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
exports.installedMSDeployVersionSupportsTokenAuth = installedMSDeployVersionSupportsTokenAuth;
|
|
277
|
+
function getMSDeployLatestRegKey() {
|
|
229
278
|
return new Promise((resolve, reject) => {
|
|
230
|
-
|
|
279
|
+
const minimalSupportedMSDeployVersion = 3;
|
|
280
|
+
const msdeployRegistryPath = "\\SOFTWARE\\Microsoft\\IIS Extensions\\MSDeploy";
|
|
281
|
+
const regKey = new winreg({
|
|
231
282
|
hive: winreg.HKLM,
|
|
232
|
-
key:
|
|
283
|
+
key: msdeployRegistryPath
|
|
233
284
|
});
|
|
234
285
|
regKey.keys(function (err, subRegKeys) {
|
|
235
286
|
if (err) {
|
|
236
287
|
reject(tl.loc("UnabletofindthelocationofMSDeployfromregistryonmachineError", err));
|
|
237
288
|
return;
|
|
238
289
|
}
|
|
239
|
-
|
|
240
|
-
|
|
290
|
+
tl.debug(`Found ${subRegKeys.length} subkeys under ${msdeployRegistryPath}`);
|
|
291
|
+
let latestKeyVersion = 0;
|
|
292
|
+
let latestSubKey;
|
|
241
293
|
for (var index in subRegKeys) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
294
|
+
const subRegKey = subRegKeys[index].key;
|
|
295
|
+
tl.debug("Found subkey " + subRegKey);
|
|
296
|
+
const subKeyVersion = subRegKey.substring(subRegKey.lastIndexOf("\\") + 1);
|
|
297
|
+
const subKeyVersionNumber = parseFloat(subKeyVersion);
|
|
298
|
+
if (!isNaN(subKeyVersionNumber) && subKeyVersionNumber > latestKeyVersion) {
|
|
299
|
+
latestKeyVersion = subKeyVersionNumber;
|
|
300
|
+
latestSubKey = subRegKeys[index];
|
|
250
301
|
}
|
|
251
302
|
}
|
|
252
|
-
if (latestKeyVersion <
|
|
303
|
+
if (latestKeyVersion < minimalSupportedMSDeployVersion) {
|
|
304
|
+
// previous versions are not compatible either with app services or web deployment tasks
|
|
253
305
|
reject(tl.loc("UnsupportedinstalledversionfoundforMSDeployversionshouldbeatleast3orabove", latestKeyVersion));
|
|
254
306
|
return;
|
|
255
307
|
}
|
|
@@ -257,68 +309,13 @@ function getMSDeployLatestRegKey(registryKey) {
|
|
|
257
309
|
});
|
|
258
310
|
});
|
|
259
311
|
}
|
|
260
|
-
function getMSDeployInstallPath(registryKey) {
|
|
261
|
-
return new Promise((resolve, reject) => {
|
|
262
|
-
var regKey = new winreg({
|
|
263
|
-
hive: winreg.HKLM,
|
|
264
|
-
key: registryKey
|
|
265
|
-
});
|
|
266
|
-
regKey.values(function (err, items) {
|
|
267
|
-
if (err) {
|
|
268
|
-
reject(tl.loc("UnabletofindthelocationofMSDeployfromregistryonmachineError", err));
|
|
269
|
-
}
|
|
270
|
-
if (shouldUseMSDeployTokenAuth()) {
|
|
271
|
-
const versionItem = items.find(item => item.name === "Version");
|
|
272
|
-
if (!versionItem) {
|
|
273
|
-
reject(tl.loc("MissingMSDeployVersionRegistryKey"));
|
|
274
|
-
}
|
|
275
|
-
const minimalSupportedVersion = "9.0.7225.0";
|
|
276
|
-
const version = versionItem.value;
|
|
277
|
-
tl.debug(`Installed MSDeploy Version: ${version}`);
|
|
278
|
-
// MSDeploy 9.0.7225.0 is the first version to support token auth
|
|
279
|
-
if (compareVersions(version, minimalSupportedVersion) < 0) {
|
|
280
|
-
reject(tl.loc("UnsupportedMSDeployVersion", version));
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
const installPathItem = items.find(item => item.name === "InstallPath");
|
|
284
|
-
if (!installPathItem) {
|
|
285
|
-
reject(tl.loc("MissingMSDeployInstallPathRegistryKey"));
|
|
286
|
-
}
|
|
287
|
-
resolve(installPathItem.value);
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
function compareVersions(version1, version2) {
|
|
292
|
-
if (version1 === version2) {
|
|
293
|
-
return 0;
|
|
294
|
-
}
|
|
295
|
-
const separator = ".";
|
|
296
|
-
const parts1 = version1.split(separator).map(Number);
|
|
297
|
-
const parts2 = version2.split(separator).map(Number);
|
|
298
|
-
const length = Math.min(parts1.length, parts2.length);
|
|
299
|
-
for (let i = 0; i < length; i++) {
|
|
300
|
-
if (parts1[i] > parts2[i]) {
|
|
301
|
-
return 1;
|
|
302
|
-
}
|
|
303
|
-
if (parts1[i] < parts2[i]) {
|
|
304
|
-
return -1;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if (parts1.length > parts2.length) {
|
|
308
|
-
return 1;
|
|
309
|
-
}
|
|
310
|
-
if (parts1.length < parts2.length) {
|
|
311
|
-
return -1;
|
|
312
|
-
}
|
|
313
|
-
return 0;
|
|
314
|
-
}
|
|
315
312
|
/**
|
|
316
313
|
* 1. Checks if msdeploy during execution redirected any error to
|
|
317
314
|
* error stream ( saved in error.txt) , display error to console
|
|
318
315
|
* 2. Checks if there is file in use error , suggest to try app offline.
|
|
319
316
|
*/
|
|
320
317
|
function redirectMSDeployErrorToConsole() {
|
|
321
|
-
var msDeployErrorFilePath = tl.getVariable('System.DefaultWorkingDirectory') + '\\' + ERROR_FILE_NAME;
|
|
318
|
+
var msDeployErrorFilePath = tl.getVariable('System.DefaultWorkingDirectory') + '\\' + exports.ERROR_FILE_NAME;
|
|
322
319
|
if (tl.exist(msDeployErrorFilePath)) {
|
|
323
320
|
var errorFileContent = fs.readFileSync(msDeployErrorFilePath).toString();
|
|
324
321
|
if (errorFileContent !== "") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-pipelines-tasks-webdeployment-common",
|
|
3
|
-
"version": "4.230.
|
|
3
|
+
"version": "4.230.5",
|
|
4
4
|
"description": "Common Lib for MSDeploy Utility",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,22 +17,25 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/Microsoft/azure-pipelines-tasks#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@types/ltx": "3.0.6",
|
|
20
21
|
"@types/mocha": "^5.2.7",
|
|
21
22
|
"@types/node": "^10.17.0",
|
|
22
23
|
"@xmldom/xmldom": "git+https://github.com/xmldom/xmldom.git#0.8.6",
|
|
23
|
-
"@types/ltx": "3.0.6",
|
|
24
24
|
"archiver": "1.2.0",
|
|
25
25
|
"azure-pipelines-task-lib": "^4.2.0",
|
|
26
26
|
"decompress-zip": "^0.3.3",
|
|
27
27
|
"ltx": "2.8.0",
|
|
28
28
|
"node-stream-zip": "^1.15.0",
|
|
29
29
|
"q": "1.4.1",
|
|
30
|
+
"semver": "^7.5.4",
|
|
30
31
|
"winreg": "1.2.2",
|
|
31
32
|
"xml2js": "0.6.2"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"
|
|
35
|
+
"@types/semver": "^7.5.4",
|
|
36
|
+
"@types/winreg": "^1.2.34",
|
|
35
37
|
"mocha": "^6.2.3",
|
|
36
|
-
"nyc": "^15.1.0"
|
|
38
|
+
"nyc": "^15.1.0",
|
|
39
|
+
"typescript": "4.0.2"
|
|
37
40
|
}
|
|
38
41
|
}
|