The docker CI job in test-pr.yaml fails at the Run forge build step when running
forge install --no-git foundry-rs/forge-std@75f1746
inside the container.
This used to work in Foundry v1.5.1, but it no longer does in v1.7.0. When building the image for the test, foundryup is run without a pinned version, hence the regression.
Error
Warning: Found unknown `rpc_endpoints` config for profile `default` defined in foundry.toml.
Installing forge-std in /home/user/foundry/lib/forge-std (url: https://github.com/foundry-rs/forge-std, tag: 75f1746)
Cloning into '/home/user/foundry/lib/forge-std'...
Error: git checkout exited with code 128:
fatal: not a git repository: ../../.git/modules/lib/ds-test
fatal: could not reset submodule index
Analysis
The src/tests/integration/test-data/foundry directory is copied into the container with docker cp, and is not a git repository. The forge-std@75f1746 tag includes ds-test as a git submodule. At some point in the v1.5.1..v1.7.0 range forge likely changed how it handles submodule checkout for libraries, causing the fatal error.
Regression
Bisected to Foundry releases: foundryup --install v1.5.1 works; v1.7.0 does not. Because the Docker image runs foundryup without a pinned version, any new enough base image will exhibit this.
Fixes
Option A: init a git repo before installing libraries
Add git init to the CI step that sets up the Foundry root so that /home/user/foundry is a real git repository before forge install runs. This also makes the --no-git flag redundant and can be dropped.
Option B: use a newer forge-std tag that no longer has the ds-test submodule
Update the pinned tag (currently 75f1746) to a revision where ds-test has been removed. This sidesteps the submodule issue without changing the container setup.
Current workaround
PR #1139 pins Foundry to v1.5.1 in the Dockerfile: foundryup --install v1.5.1. Pinning the version is probably not a bad idea in itself, but in order to be able to update from this version, one of the fixes need to be applied.
The
dockerCI job intest-pr.yamlfails at theRun forge buildstep when runninginside the container.
This used to work in Foundry
v1.5.1, but it no longer does inv1.7.0. When building the image for the test,foundryupis run without a pinned version, hence the regression.Error
Analysis
The
src/tests/integration/test-data/foundrydirectory is copied into the container withdocker cp, and is not agitrepository. Theforge-std@75f1746tag includesds-testas a git submodule. At some point in thev1.5.1..v1.7.0rangeforgelikely changed how it handles submodule checkout for libraries, causing the fatal error.Regression
Bisected to Foundry releases:
foundryup --install v1.5.1works;v1.7.0does not. Because the Docker image runsfoundryupwithout a pinned version, any new enough base image will exhibit this.Fixes
Option A: init a git repo before installing libraries
Add
git initto the CI step that sets up the Foundry root so that/home/user/foundryis a real git repository beforeforge installruns. This also makes the--no-gitflag redundant and can be dropped.Option B: use a newer
forge-stdtag that no longer has theds-testsubmoduleUpdate the pinned tag (currently
75f1746) to a revision whereds-testhas been removed. This sidesteps the submodule issue without changing the container setup.Current workaround
PR #1139 pins Foundry to
v1.5.1in theDockerfile:foundryup --install v1.5.1. Pinning the version is probably not a bad idea in itself, but in order to be able to update from this version, one of the fixes need to be applied.