feat: cache cloned repos in ~/.cache/harness-openshell/repos/#79
Merged
Conversation
Repos are cached persistently so subsequent runs only fetch deltas instead of re-cloning. On cache hit: git fetch --depth 1, checkout the ref, update submodules, clean untracked files. On cache miss: fresh shallow clone with submodules. Cleanup function is a no-op since the cache is persistent.
Drop --recursive from submodule init. One level of submodules is sufficient for most repos and avoids pulling deeply nested submodule trees (e.g., third-party vendored dependencies).
Set HARNESS_OS_IMAGE to the Dockerfile directory so openshell builds the sandbox image locally from the Dockerfile instead of pulling from the registry. This avoids the race between images.yml pushing and integration.yml pulling, and avoids the Docker/Podman image store mismatch on CI runners. Also reverts test-local Makefile target to not build — CI handles the image via HARNESS_OS_IMAGE, local dev uses the version-matched registry tag or HARNESS_OS_IMAGE override.
macOS: Podman gateway can't see Docker-built images. test-local now depends on dev-push so the image is in the registry. CI (Linux): Docker gateway and Docker build share the same daemon. CI uses HARNESS_OS_IMAGE=profiles/images/sandbox-default so openshell builds from the Dockerfile directly — no registry pull needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Repos specified via
repo:in agent configs are now cached persistently at~/.cache/harness-openshell/repos/<repo-name>/. Subsequent runs fetch deltas instead of re-cloning.git fetch --depth 1+ checkout ref + submodule update + clean untrackedThis matters for large repos with submodules (e.g., stackrox/collector) where a fresh clone takes minutes.
Test plan
make test— all passrepo:clones fresh into cache dirrepo_refbetween runs checks out the new ref