Skip to content

Commit

Permalink
feat: copy 'test' files only in TEST stage
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jan 16, 2025
1 parent 042c5ba commit c5de106
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ All proposals then have two additional stages:
- `USE` Perform actions to update the chain state, to persist through the chain history. E.g. adding a vault that will be tested again in the future.
- `TEST` Test the chain state and perform new actions that should not be part of history. E.g. adding a contract that never was on Mainnet.

The `TEST` stage does not RUN as part of the build. It only defines the ENTRYPOINT and CI runs them all.
The `TEST` stage does not RUN as part of the build. It only copies test files into the image and defines the ENTRYPOINT. CI runs those entrypoints to execute the tests.
(Note that some other phases use tests too, for example to pre-test, so files like `pre.test.js` are always copied. Only `test.sh` and a `test` dir are excluded from stages before TEST.)

The `USE` stage is built into images that are pushed to the image repository. These can be used by release branches to source a particular state of the synthetic chain.

Expand Down
11 changes: 8 additions & 3 deletions packages/synthetic-chain/src/cli/dockerfileGen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ENV \
UPGRADE_INFO=${JSON.stringify(encodeUpgradeInfo(upgradeInfo))} \
SKIP_PROPOSAL_VALIDATION=${skipProposalValidation}
COPY --link --chmod=755 ./proposals/${path} /usr/src/proposals/${path}
COPY --exclude=test --exclude=test.sh --link --chmod=755 ./proposals/${path} /usr/src/proposals/${path}
COPY --link --chmod=755 ./upgrade-test-scripts/env_setup.sh ./upgrade-test-scripts/run_prepare.sh ./upgrade-test-scripts/start_to_to.sh /usr/src/upgrade-test-scripts/
WORKDIR /usr/src/upgrade-test-scripts
SHELL ["/bin/bash", "-c"]
Expand All @@ -100,7 +100,7 @@ FROM ghcr.io/agoric/agoric-sdk:${sdkImageTag} as execute-${proposalName}
WORKDIR /usr/src/upgrade-test-scripts
# base is a fresh sdk image so set up the proposal and its dependencies
COPY --link --chmod=755 ./proposals/${path} /usr/src/proposals/${path}
COPY --exclude=test --exclude=test.sh --link --chmod=755 ./proposals/${path} /usr/src/proposals/${path}
COPY --link --chmod=755 ./upgrade-test-scripts/env_setup.sh ./upgrade-test-scripts/run_execute.sh ./upgrade-test-scripts/start_to_to.sh ./upgrade-test-scripts/install_deps.sh /usr/src/upgrade-test-scripts/
RUN --mount=type=cache,target=/root/.yarn ./install_deps.sh ${path}
Expand All @@ -122,7 +122,7 @@ RUN ./run_execute.sh ${planName}
# EVAL ${proposalName}
FROM use-${lastProposal.proposalName} as eval-${proposalName}
COPY --link --chmod=755 ./proposals/${path} /usr/src/proposals/${path}
COPY --exclude=test --exclude=test.sh --link --chmod=755 ./proposals/${path} /usr/src/proposals/${path}
WORKDIR /usr/src/upgrade-test-scripts
Expand Down Expand Up @@ -168,6 +168,11 @@ ENTRYPOINT ./start_agd.sh
# TEST ${proposalName}
FROM use-${proposalName} as test-${proposalName}
# Previous stages copied excluding test files (see COPY above). It would be good
# to copy only missing files, but there may be none. Fortunately, copying extra
# does not invalidate other images because nothing depends on this layer.
COPY --link --chmod=755 ./proposals/${path} /usr/src/proposals/${path}
WORKDIR /usr/src/upgrade-test-scripts
COPY --link --chmod=755 ./upgrade-test-scripts/run_test.sh /usr/src/upgrade-test-scripts/
Expand Down

0 comments on commit c5de106

Please sign in to comment.