Skip to content

Commit

Permalink
feat: debug eval image
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Nov 27, 2023
1 parent 38540ca commit 4ec09d6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ export function lastPassedProposal(proposals: ProposalInfo[]): ProposalInfo {
return last;
}

export function imageNameForProposalEval(proposal) {
const target = `eval-${proposal.proposalName}`;
return {
name: `${repository}:${target}`,
target,
};
}

export function imageNameForProposalTest(proposal) {
const target = `test-${proposal.proposalName}`;
return {
Expand Down
34 changes: 34 additions & 0 deletions debugEvalImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env tsx
/**
* @file like runTestImages.ts, but for a single proposal,
* and with a bash entrypoint
*/
import { execSync } from 'node:child_process';
import { parseArgs } from 'node:util';
import { imageNameForProposalEval, readOneProposal } from './common';

const options = {
match: { short: 'm', type: 'string' },
} as const;
const { values } = parseArgs({ options });

const proposal = readOneProposal(values.match!);

console.log(
`Starting shell of eval image for proposal ${proposal.proposalName}`,
);
// SLOGFILE isn't in the regular build because it's huge
console.log('If you want a SLOGFILE:');
console.log(' export SLOGFILE=slog.slog');
console.log('Run the following command to start a chain:');
console.log(' agd start --log_level warn');
console.log('This gets another shell:');
console.log(
' docker exec -it `docker ps --latest --format json | jq -r .Names` bash',
);
console.log('And within that shell:');
console.log(' cd /usr/src/proposals/"$PROPOSAL_PATH/" && ./eval.sh');
const { name } = imageNameForProposalEval(proposal);
// start the chain
const cmd = `docker run --mount type=bind,src=.,dst=/usr/src/a3p -it --entrypoint bash ${name}`;
execSync(cmd, { stdio: 'inherit' });

0 comments on commit 4ec09d6

Please sign in to comment.