diff --git a/build/azure-pipelines/linux/codesign.js b/build/azure-pipelines/linux/codesign.js index 4b69f8aecc9..e52d8797a55 100644 --- a/build/azure-pipelines/linux/codesign.js +++ b/build/azure-pipelines/linux/codesign.js @@ -14,11 +14,13 @@ function printBanner(title) { console.log('#'.repeat(75)); console.log('\n'); } -async function handleProcessPromise(name, promise) { +async function streamTaskOutputAndCheckResult(name, promise) { const result = await promise.pipe(process.stdout); - if (!result.ok) { - throw new Error(`${name} failed: ${result.stderr}`); + 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}`; @@ -32,15 +34,15 @@ async function main() { const codesignTask2 = sign(esrpCliDLLPath, 'sign-pgp', '.build/linux/rpm', '*.rpm'); // Codesign deb package printBanner('Codesign deb package'); - await handleProcessPromise('Codesign deb package', codesignTask1); + await streamTaskOutputAndCheckResult('Codesign deb package', codesignTask1); // Codesign rpm package printBanner('Codesign rpm package'); - await handleProcessPromise('Codesign rpm package', codesignTask2); + await streamTaskOutputAndCheckResult('Codesign rpm package', codesignTask2); } main().then(() => { process.exit(0); }, err => { - console.error(err); + console.error(`ERROR: ${err}`); process.exit(1); }); //# sourceMappingURL=codesign.js.map \ No newline at end of file diff --git a/build/azure-pipelines/linux/codesign.ts b/build/azure-pipelines/linux/codesign.ts index 4cdab84dbae..49cd0756bf3 100644 --- a/build/azure-pipelines/linux/codesign.ts +++ b/build/azure-pipelines/linux/codesign.ts @@ -16,11 +16,14 @@ function printBanner(title: string) { console.log('\n'); } -async function handleProcessPromise(name: string, promise: ProcessPromise): Promise { +async function streamTaskOutputAndCheckResult(name: string, promise: ProcessPromise): Promise { const result = await promise.pipe(process.stdout); - if (!result.ok) { - throw new Error(`${name} failed: ${result.stderr}`); + if (result.ok) { + console.log(`\n${name} completed successfully. Duration: ${result.duration} ms`); + return; } + + throw new Error(`${name} failed: ${result.stderr}`); } function sign(esrpCliDLLPath: string, type: 'sign-pgp', folder: string, glob: string): ProcessPromise { @@ -38,16 +41,16 @@ async function main() { // Codesign deb package printBanner('Codesign deb package'); - await handleProcessPromise('Codesign deb package', codesignTask1); + await streamTaskOutputAndCheckResult('Codesign deb package', codesignTask1); // Codesign rpm package printBanner('Codesign rpm package'); - await handleProcessPromise('Codesign rpm package', codesignTask2); + await streamTaskOutputAndCheckResult('Codesign rpm package', codesignTask2); } main().then(() => { process.exit(0); }, err => { - console.error(err); + console.error(`ERROR: ${err}`); process.exit(1); }); diff --git a/build/azure-pipelines/linux/product-build-linux.yml b/build/azure-pipelines/linux/product-build-linux.yml index e7dd217bbdc..96f76f6846a 100644 --- a/build/azure-pipelines/linux/product-build-linux.yml +++ b/build/azure-pipelines/linux/product-build-linux.yml @@ -379,7 +379,7 @@ steps: echo "##vso[task.setvariable variable=EsrpCliDllPath]$Version/net6.0/esrpcli.dll" displayName: Find ESRP CLI - - script: npx deemon -- npx zx build/azure-pipelines/linux/codesign.js + - script: npx deemon --detach --wait node build/azure-pipelines/linux/codesign.js env: EsrpCliDllPath: $(EsrpCliDllPath) SYSTEM_ACCESSTOKEN: $(System.AccessToken) @@ -397,9 +397,9 @@ steps: PUBLISH_TASK_NAME: 1ES.PublishPipelineArtifact@1 - ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'oss')) }}: - # - script: npx deemon --attach -- npx zx build/azure-pipelines/linux/codesign.js - # condition: succeededOrFailed() - # displayName: "✍️ Post-job: Codesign deb & rpm" + - script: npx deemon --attach node build/azure-pipelines/linux/codesign.js + condition: succeededOrFailed() + displayName: "✍️ Post-job: Codesign deb & rpm" - script: echo "##vso[task.setvariable variable=ARTIFACT_PREFIX]attempt$(System.JobAttempt)_" condition: and(succeededOrFailed(), notIn(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues'))