Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: main build has only PASSED proposals #24

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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