Quote script paths in extension tasks (#419)

This commit is contained in:
Luis Chacón 2021-02-10 16:11:21 -08:00 коммит произвёл GitHub
Родитель c339995952
Коммит 533474b989
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 33 добавлений и 25 удалений

Просмотреть файл

@ -10,9 +10,9 @@
"integrity": "sha512-pC/hkcREG6YfDfui1FBmj8e20jFU5Exjw4NYDm8kEdrW+mOh0T1Zve8DWKnS7ZIZvgncrctcNCXF4Q2I+loyww=="
},
"@types/xml2js": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.5.tgz",
"integrity": "sha512-yohU3zMn0fkhlape1nxXG2bLEGZRc1FeqF80RoHaYXJN7uibaauXfhzhOJr1Xh36sn+/tx21QAOf07b/xYVk1w==",
"version": "0.4.8",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.8.tgz",
"integrity": "sha512-EyvT83ezOdec7BhDaEcsklWy7RSIdi6CNe95tmOAK0yx/Lm30C9K75snT3fYayK59ApC2oyW+rcHErdG05FHJA==",
"requires": {
"@types/node": "*"
}

Просмотреть файл

@ -22,13 +22,7 @@ const run = async () =>
// The script requires the command path to be absolute.
const fullVhdxPath: string = path.resolve(vhdxPath);
const powershellRunner: ToolRunner = tl.tool('powershell');
powershellRunner.arg('-NoLogo');
powershellRunner.arg('-NoProfile');
powershellRunner.arg('-NonInteractive');
powershellRunner.arg(['-ExecutionPolicy', 'Unrestricted']);
powershellRunner.arg(GENERATE_VHDX_SCRIPT_PATH);
const powershellRunner: ToolRunner = helpers.getPowershellRunner(GENERATE_VHDX_SCRIPT_PATH);
powershellRunner.arg(['-vhdxPath', fullVhdxPath]);
powershellRunner.arg(['-vhdxSize', vhdxSize]);
powershellRunner.arg(['-msixPackagePath', packagePath]);

Просмотреть файл

@ -10,9 +10,9 @@
"integrity": "sha512-Wk7nG1JSaMfMpoMJDKUsWYugliB2Vy55pdjLpmLixeyMi7HizW2I/9QoxsPCkXl3dO+ZOVqPumKaDUv5zJu2uQ=="
},
"@types/xml2js": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.5.tgz",
"integrity": "sha512-yohU3zMn0fkhlape1nxXG2bLEGZRc1FeqF80RoHaYXJN7uibaauXfhzhOJr1Xh36sn+/tx21QAOf07b/xYVk1w==",
"version": "0.4.8",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.8.tgz",
"integrity": "sha512-EyvT83ezOdec7BhDaEcsklWy7RSIdi6CNe95tmOAK0yx/Lm30C9K75snT3fYayK59ApC2oyW+rcHErdG05FHJA==",
"requires": {
"@types/node": "*"
}

Просмотреть файл

@ -69,12 +69,7 @@ const getMSBuildPathFromVersion = async (msbuildVersion: string, msbuildArchitec
// The Powershell helper only works on Windows;
// it looks in the Global Assembly Cache to find the right version.
// We use a wrapper script to call the right function from the helper.
const powershellRunner = tl.tool('powershell');
powershellRunner.arg('-NoLogo');
powershellRunner.arg('-NoProfile');
powershellRunner.arg('-NonInteractive');
powershellRunner.arg(['-ExecutionPolicy', 'Unrestricted']);
powershellRunner.arg(MSBUILD_PATH_HELPER_SCRIPT);
const powershellRunner: ToolRunner = helpers.getPowershellRunner(MSBUILD_PATH_HELPER_SCRIPT);
powershellRunner.arg(['-PreferredVersion', msbuildVersion]);
powershellRunner.arg(['-Architecture', msbuildArchitecture]);

Просмотреть файл

@ -10,9 +10,9 @@
"integrity": "sha512-Wk7nG1JSaMfMpoMJDKUsWYugliB2Vy55pdjLpmLixeyMi7HizW2I/9QoxsPCkXl3dO+ZOVqPumKaDUv5zJu2uQ=="
},
"@types/xml2js": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.5.tgz",
"integrity": "sha512-yohU3zMn0fkhlape1nxXG2bLEGZRc1FeqF80RoHaYXJN7uibaauXfhzhOJr1Xh36sn+/tx21QAOf07b/xYVk1w==",
"version": "0.4.8",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.8.tgz",
"integrity": "sha512-EyvT83ezOdec7BhDaEcsklWy7RSIdi6CNe95tmOAK0yx/Lm30C9K75snT3fYayK59ApC2oyW+rcHErdG05FHJA==",
"requires": {
"@types/node": "*"
}

6
tools/pipelines-tasks/MsixSigning/package-lock.json сгенерированный
Просмотреть файл

@ -16,9 +16,9 @@
"dev": true
},
"@types/xml2js": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.5.tgz",
"integrity": "sha512-yohU3zMn0fkhlape1nxXG2bLEGZRc1FeqF80RoHaYXJN7uibaauXfhzhOJr1Xh36sn+/tx21QAOf07b/xYVk1w==",
"version": "0.4.8",
"resolved": "https://registry.npmjs.org/@types/xml2js/-/xml2js-0.4.8.tgz",
"integrity": "sha512-EyvT83ezOdec7BhDaEcsklWy7RSIdi6CNe95tmOAK0yx/Lm30C9K75snT3fYayK59ApC2oyW+rcHErdG05FHJA==",
"requires": {
"@types/node": "*"
}

Просмотреть файл

@ -34,6 +34,25 @@ export const getInputWithErrorCheck = (variableName: string, errorMessage: strin
return variableValue;
}
/**
* Gets a ToolRunner for running a Powershell script.
* Script arguments can be added later by the caller.
* @param scriptPath Script to run.
*/
export const getPowershellRunner = (scriptPath: string): ToolRunner =>
{
const powershellRunner: ToolRunner = tl.tool('powershell')
.arg('-NoLogo')
.arg('-NoProfile')
.arg('-NonInteractive')
.arg(['-ExecutionPolicy', 'Unrestricted']);
// Quote the script path to allow for spaces.
// Existing quotes need to be escaped.
powershellRunner.arg(`& '${scriptPath.replace("'", "''")}'`);
return powershellRunner;
}
/**
* Increment the current version given by the method specified. A version
* is in the form of (major).(minor).(build).(revision). The incremental