Skip to content

Commit 7595f31

Browse files
Add the previous version of 7zip (#456)
Add the previous version of 7zip by default and the feature flag that switches 7zip version from v23.01 to v24.09
1 parent 3bc5e29 commit 7595f31

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

common-npm-packages/webdeployment-common/build.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
node ../build-scripts/downloadArchive.js https://vstsagenttools.blob.core.windows.net/tools/7zip/24.09/7zip.zip ./7zip
1+
node ../build-scripts/downloadArchive.js https://vstsagenttools.blob.core.windows.net/tools/7zip/5/7zip.zip ./7zip
2+
node ../build-scripts/downloadArchive.js https://vstsagenttools.blob.core.windows.net/tools/7zip/24.09/7zip.zip ./7zip24
23
node ../build-scripts/downloadArchive.js https://vstsagenttools.blob.core.windows.net/tools/MSDeploy/3.6/M142/MSDeploy.zip ./MSDeploy/M142
34
node ../build-scripts/downloadArchive.js https://vstsagenttools.blob.core.windows.net/tools/MSDeploy/3.6/M229/MSDeploy.zip ./MSDeploy/M229
45
node ../build-scripts/downloadArchive.js https://vstsagenttools.blob.core.windows.net/tools/ctt/1.6/ctt.zip ./ctt

common-npm-packages/webdeployment-common/make.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ util.cp(path.join(__dirname, 'package.json'), buildPath);
1010
util.cp(path.join(__dirname, 'package-lock.json'), buildPath);
1111
util.cp(path.join(__dirname, 'module.json'), buildPath);
1212
util.cp('-r', '7zip', buildPath);
13+
util.cp('-r', '7zip24', buildPath);
1314
util.cp('-r', 'ctt', buildPath);
1415
util.cp('-r', 'MSDeploy', buildPath);
1516
util.cp('-r', 'node_modules', buildPath);

common-npm-packages/webdeployment-common/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common-npm-packages/webdeployment-common/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "azure-pipelines-tasks-webdeployment-common",
3-
"version": "4.256.1",
3+
"version": "4.257.0",
44
"description": "Common Lib for MSDeploy Utility",
55
"repository": {
66
"type": "git",
77
"url": "git+https://github.com/microsoft/azure-pipelines-tasks-common-packages.git",
88
"directory": "common-npm-packages/webdeployment-common"
99
},
1010
"scripts": {
11+
"prebuild": "cd ../build-scripts && npm install",
1112
"build": "pwsh build.ps1",
1213
"test": "nyc --all --src ./_build mocha ./_build/Tests/L0.js"
1314
},

common-npm-packages/webdeployment-common/ziputility.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var archiver = require('archiver');
88

99
const deleteDir = (path: string) => tl.exist(path) && tl.rmRF(path);
1010

11-
const extractWindowsZip = async (fromFile: string, toDir: string, usePowerShell?: boolean) => {
11+
const extractWindowsZip = async (fromFile: string, toDir: string, usePowerShell?: boolean) => {
1212
let forceUsePSUnzip: string = process.env['ADO_FORCE_USE_PSUNZIP'] || 'false'
1313
tl.debug(`ADO_FORCE_USE_PSUNZIP = '${forceUsePSUnzip}'`)
1414
if (forceUsePSUnzip.toLowerCase() === 'true') {
@@ -59,7 +59,7 @@ const extractUsingPowerShell = async (fromFile: string, toDir: string) => {
5959
.arg('-NonInteractive')
6060
.arg('-Command')
6161
.arg(command);
62-
62+
6363
let options = <tr.IExecOptions>{
6464
failOnStdErr: false,
6565
errStream: process.stdout,
@@ -87,8 +87,16 @@ const extractUsingPowerShell = async (fromFile: string, toDir: string) => {
8787
}
8888

8989
const extractUsing7zip = async (fromFile: string, toDir: string) => {
90-
tl.debug('Using 7zip tool for extracting');
91-
var win7zipLocation = path.join(__dirname, '7zip/7zip/7z.exe');
90+
let win7zipLocation: string;
91+
92+
if (tl.getPipelineFeature("Use7zV2409InWebDeploymentCommonPackage")) {
93+
win7zipLocation = path.join(__dirname, '7zip24/7zip/7z.exe');
94+
} else {
95+
win7zipLocation = path.join(__dirname, '7zip/7zip/7z.exe');
96+
}
97+
98+
tl.debug(`Using 7zip tool from ${win7zipLocation} for extracting`);
99+
92100
await tl.tool(win7zipLocation)
93101
.arg([ 'x', `-o${toDir}`, fromFile ])
94102
.exec();
@@ -104,14 +112,14 @@ const extractUsingUnzip = async (fromFile: string, toDir: string) => {
104112

105113
export async function unzip(zipFileLocation: string, unzipDirLocation: string) {
106114
deleteDir(unzipDirLocation);
107-
115+
108116
const isWin = tl.getPlatform() === tl.Platform.Windows;
109117
tl.debug('windows platform: ' + isWin);
110118

111-
tl.debug('extracting ' + zipFileLocation + ' to ' + unzipDirLocation);
119+
tl.debug('extracting ' + zipFileLocation + ' to ' + unzipDirLocation);
112120
if (isWin) {
113121
await extractWindowsZip(zipFileLocation, unzipDirLocation);
114-
}
122+
}
115123
else{
116124
await extractUsingUnzip(zipFileLocation, unzipDirLocation);
117125
}

0 commit comments

Comments
 (0)