Engineering - refactor codesign scripts (#246459)

* Engineering - consolidate codesign scripts

* Try using a script task

* Switch back to old syntax

* Bump deemon
This commit is contained in:
Ladislau Szomoru
2025-04-14 08:13:45 +01:00
committed by GitHub
parent 956efd2c00
commit 1799c2beaa
11 changed files with 140 additions and 176 deletions

View File

@@ -4,40 +4,21 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const zx_1 = require("zx");
const codesign_1 = require("../common/codesign");
const publish_1 = require("../common/publish");
function printBanner(title) {
title = `${title} (${new Date().toISOString()})`;
console.log('\n');
console.log('#'.repeat(75));
console.log(`# ${title.padEnd(71)} #`);
console.log('#'.repeat(75));
console.log('\n');
}
async function streamTaskOutputAndCheckResult(name, promise) {
const result = await promise.pipe(process.stdout);
if (result.ok) {
console.log(`\n${name} completed successfully. Duration: ${result.duration} ms`);
return;
}
throw new Error(`${name} failed: ${result.stderr}`);
}
function sign(esrpCliDLLPath, type, folder, glob) {
return (0, zx_1.$) `node build/azure-pipelines/common/sign ${esrpCliDLLPath} ${type} ${folder} ${glob}`;
}
async function main() {
const esrpCliDLLPath = (0, publish_1.e)('EsrpCliDllPath');
// Start the code sign processes in parallel
// 1. Codesign deb package
// 2. Codesign rpm package
const codesignTask1 = sign(esrpCliDLLPath, 'sign-pgp', '.build/linux/deb', '*.deb');
const codesignTask2 = sign(esrpCliDLLPath, 'sign-pgp', '.build/linux/rpm', '*.rpm');
const codesignTask1 = (0, codesign_1.spawnCodesignProcess)(esrpCliDLLPath, 'sign-pgp', '.build/linux/deb', '*.deb');
const codesignTask2 = (0, codesign_1.spawnCodesignProcess)(esrpCliDLLPath, 'sign-pgp', '.build/linux/rpm', '*.rpm');
// Codesign deb package
printBanner('Codesign deb package');
await streamTaskOutputAndCheckResult('Codesign deb package', codesignTask1);
(0, codesign_1.printBanner)('Codesign deb package');
await (0, codesign_1.streamProcessOutputAndCheckResult)('Codesign deb package', codesignTask1);
// Codesign rpm package
printBanner('Codesign rpm package');
await streamTaskOutputAndCheckResult('Codesign rpm package', codesignTask2);
(0, codesign_1.printBanner)('Codesign rpm package');
await (0, codesign_1.streamProcessOutputAndCheckResult)('Codesign rpm package', codesignTask2);
}
main().then(() => {
process.exit(0);