Skip to content

Commit

Permalink
fix: main build has only PASSED proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Nov 10, 2023
1 parent 4ba8231 commit 647b5e8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions common.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions makeDockerfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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#----------------`,
Expand All @@ -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');
Expand Down

0 comments on commit 647b5e8

Please sign in to comment.