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 default entrypoint #53

Merged
merged 1 commit into from
Jan 9, 2024
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
15 changes: 11 additions & 4 deletions packages/synthetic-chain/src/cli/dockerfileGen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// @ts-check

import fs from 'node:fs';
import type {
CoreEvalProposal,
ProposalInfo,
SoftwareUpgradeProposal,
import {
lastPassedProposal,
type CoreEvalProposal,
type ProposalInfo,
type SoftwareUpgradeProposal,
} from './proposals.js';

/**
Expand Down Expand Up @@ -242,6 +243,12 @@ export function writeDockerfile(
blocks.push(stage.TEST(proposal));
previousProposal = proposal;
}
// If one of the proposals is a passed proposal, make the latest one the default entrypoint
const lastPassed = lastPassedProposal(allProposals);
if (lastPassed) {
blocks.push(stage.DEFAULT(lastPassed));
}
Comment on lines +246 to +250
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const contents = blocks.join('\n');
fs.writeFileSync('Dockerfile', contents);
}
8 changes: 4 additions & 4 deletions packages/synthetic-chain/src/cli/proposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ export const matchOneProposal = (
return proposals[0];
};

export function lastPassedProposal(proposals: ProposalInfo[]): ProposalInfo {
const last = proposals.findLast(p => p.proposalIdentifier.match(/^\d/));
assert(last, 'no passed proposals');
return last;
export function lastPassedProposal(
proposals: ProposalInfo[],
): ProposalInfo | undefined {
return proposals.findLast(p => p.proposalIdentifier.match(/^\d/));
}

export function imageNameForProposal(
Expand Down