Skip to content

feat: cache cloned repos in ~/.cache/harness-openshell/repos/#79

Merged
robbycochran merged 5 commits into
mainfrom
rc-git-cache
Jun 17, 2026
Merged

feat: cache cloned repos in ~/.cache/harness-openshell/repos/#79
robbycochran merged 5 commits into
mainfrom
rc-git-cache

Conversation

@robbycochran

Copy link
Copy Markdown
Collaborator

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.

  • Cache hit: git fetch --depth 1 + checkout ref + submodule update + clean untracked
  • Cache miss: fresh shallow clone with submodules (same as before)

This matters for large repos with submodules (e.g., stackrox/collector) where a fresh clone takes minutes.

Test plan

  • make test — all pass
  • First run with repo: clones fresh into cache dir
  • Second run fetches only (fast)
  • Changing repo_ref between runs checks out the new ref

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.
@robbycochran robbycochran merged commit 08e8790 into main Jun 17, 2026
6 checks passed
@robbycochran robbycochran deleted the rc-git-cache branch June 17, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant