diff --git a/buildTestImages.ts b/buildTestImages.ts index 7f89b68b..05dfff77 100755 --- a/buildTestImages.ts +++ b/buildTestImages.ts @@ -2,7 +2,7 @@ import { parseArgs } from 'node:util'; import { execSync } from 'node:child_process'; -import { imageNameForProposalTest, readProposals } from './common'; +import { imageNameForProposal, readProposals } from './common'; import { refreshDockerfile } from './makeDockerfile'; refreshDockerfile(); @@ -25,7 +25,7 @@ for (const proposal of proposals) { if (!dry) { console.log(`\nBuilding test image for proposal ${proposal.proposalName}`); } - const { name, target } = imageNameForProposalTest(proposal); + const { name, target } = imageNameForProposal(proposal, 'test'); // 'load' to ensure the images are output to the Docker client. Seems to be necessary // for the CI docker/build-push-action to re-use the cached stages. const cmd = `docker buildx build --load --tag ${name} --target ${target} .`; diff --git a/common.ts b/common.ts index 582e967e..b50d454e 100644 --- a/common.ts +++ b/common.ts @@ -62,16 +62,11 @@ 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}`; +export function imageNameForProposal( + proposal: ProposalCommon, + stage: 'test' | 'eval', +) { + const target = `${stage}-${proposal.proposalName}`; return { name: `${repository}:${target}`, target, diff --git a/debugEvalImage.ts b/debugEvalImage.ts index c63277e1..c0bba518 100755 --- a/debugEvalImage.ts +++ b/debugEvalImage.ts @@ -5,7 +5,7 @@ */ import { execSync } from 'node:child_process'; import { parseArgs } from 'node:util'; -import { imageNameForProposalEval, readOneProposal } from './common'; +import { imageNameForProposal, readOneProposal } from './common'; const options = { match: { short: 'm', type: 'string' }, @@ -28,7 +28,7 @@ console.log( ); console.log('And within that shell:'); console.log(' cd /usr/src/proposals/"$PROPOSAL_PATH/" && ./eval.sh'); -const { name } = imageNameForProposalEval(proposal); +const { name } = imageNameForProposal(proposal, 'eval'); // start the chain const cmd = `docker run --mount type=bind,src=.,dst=/usr/src/a3p -it --entrypoint bash ${name}`; execSync(cmd, { stdio: 'inherit' }); diff --git a/debugTestImage.ts b/debugTestImage.ts index e7142eb9..4aebac55 100755 --- a/debugTestImage.ts +++ b/debugTestImage.ts @@ -5,7 +5,7 @@ */ import { execSync } from 'node:child_process'; import { parseArgs } from 'node:util'; -import { imageNameForProposalTest, readOneProposal } from './common'; +import { imageNameForProposal, readOneProposal } from './common'; const options = { match: { short: 'm', type: 'string' }, @@ -31,7 +31,7 @@ To get the latest code from your checkout of the repo: `, ); -const { name } = imageNameForProposalTest(proposal); +const { name } = imageNameForProposal(proposal, 'test'); // start the chain const cmd = `docker run --mount type=bind,src=.,dst=/usr/src/a3p -it --entrypoint /usr/src/upgrade-test-scripts/start_agd.sh ${name}`; execSync(cmd, { stdio: 'inherit' }); diff --git a/runTestImages.ts b/runTestImages.ts index b9dd11ba..786a7416 100755 --- a/runTestImages.ts +++ b/runTestImages.ts @@ -2,7 +2,7 @@ import { parseArgs } from 'node:util'; import { execSync } from 'node:child_process'; -import { imageNameForProposalTest, readProposals } from './common'; +import { imageNameForProposal, readProposals } from './common'; const options = { match: { short: 'm', type: 'string' }, @@ -19,7 +19,7 @@ const proposals = match for (const proposal of proposals) { console.log(`Running test image for proposal ${proposal.proposalName}`); - const { name } = imageNameForProposalTest(proposal); + const { name } = imageNameForProposal(proposal, 'test'); // 'rm' to remove the container when it exits const cmd = `docker run --rm ${name}`; execSync(cmd, { stdio: 'inherit' });