From 647b5e84d5334463c9bccf08a3bc695f3765e3d6 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Fri, 10 Nov 2023 06:33:20 -0800 Subject: [PATCH] fix: main build has only PASSED proposals --- common.ts | 8 ++++++++ makeDockerfile.ts | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/common.ts b/common.ts index 7bf3e3e4..3dd2f5f8 100644 --- a/common.ts +++ b/common.ts @@ -1,6 +1,7 @@ #!/usr/bin/env tsx // @ts-check +import assert from 'node:assert'; import fs from 'node:fs'; import * as path from 'node:path'; @@ -44,6 +45,13 @@ export function readProposals(): ProposalInfo[] { return proposalPaths.map(readInfo); } +export function lastPassedProposal(proposals: ProposalInfo[]): ProposalInfo { + // @ts-expect-error use es2023; findLast is available in Node 18 + const last = proposals.findLast(p => p.proposalIdentifier.match(/^\d/)); + assert(last, 'no passed proposals'); + return last; +} + export function imageNameForProposalTest(proposal) { const target = `test-${proposal.proposalName}`; return { diff --git a/makeDockerfile.ts b/makeDockerfile.ts index 0b6e61ea..5073f52c 100755 --- a/makeDockerfile.ts +++ b/makeDockerfile.ts @@ -3,7 +3,7 @@ import assert from 'node:assert'; import fs from 'node:fs'; -import { readProposals } from './common'; +import { lastPassedProposal, readProposals } from './common'; import type { ProposalInfo, SoftwareUpgradeProposal, @@ -177,8 +177,9 @@ ENTRYPOINT ./start_agd.sh // The upgrade doesn't happen until the next stage begins executing. const blocks: string[] = []; +const allProposals = readProposals(); let previousProposal: ProposalInfo | null = null; -for (const proposal of readProposals()) { +for (const proposal of allProposals) { // UNTIL region support https://github.com/microsoft/vscode-docker/issues/230 blocks.push( `#----------------\n# ${proposal.proposalName}\n#----------------`, @@ -202,7 +203,7 @@ for (const proposal of readProposals()) { blocks.push(stage.TEST(proposal)); previousProposal = proposal; } -blocks.push(stage.DEFAULT(previousProposal!)); +blocks.push(stage.DEFAULT(lastPassedProposal(allProposals))); export function refreshDockerfile() { const contents = blocks.join('\n');