Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .agents/skills/testing-git-cache-runtime/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Create a local config file with:
- `[object_store] kind = "local"` with `root` pointing at the isolated object-store directory
- `allowed_upstream_hosts = ["github.com"]`
- `[disk] min_free_bytes = 0` for small local test fixtures
- `[git_remote] enabled = true` if testing HTTP git routes
- `[compaction] chain_depth_threshold = 2` when you need a three-pack generation head to compact quickly (the threshold counts packs referenced by the head generation manifest)
- `[compaction] inline = false` unless inline compaction itself is the feature under test

Expand Down
5 changes: 0 additions & 5 deletions .agents/skills/testing-git-remote/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ root = "/tmp/gitcache-test/object-store"
[disk]
quota_bytes = 10737418240
min_free_bytes = 1073741824

[git_remote]
enabled = true
branch_ref_check = "always"
commit_read_through = true
```

### 2. Start the server
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ from the file.

| Variable | Default | What it does |
| --- | --- | --- |
| `GIT_CACHE_GIT_REMOTE_ENABLED` | `true` | Serve the read-through Git remote at `/git/{host}/{owner}/{repo}.git`. |
| `GIT_CACHE_GIT_REMOTE_COMMIT_READ_THROUGH` | `true` | Fetch missing commits from upstream during a client request instead of failing. |
| `GIT_CACHE_GIT_REMOTE_PROXY_ON_MISS_BY_DEFAULT` | `true` | On a cold miss, proxy upstream's upload-pack response to the client immediately and warm the cache in the background. |
| `GIT_CACHE_GIT_REMOTE_PROXY_TEE_IMPORT` | `true` | While proxying a cold miss, tee the response into the local cache instead of re-fetching upstream afterwards. |
Expand Down
1 change: 0 additions & 1 deletion config/local.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ quota_bytes = 10737418240
min_free_bytes = 1073741824

[git_remote]
enabled = true
commit_read_through = true

[compaction]
Expand Down
1 change: 0 additions & 1 deletion config/minio.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ quota_bytes = 10737418240
min_free_bytes = 1073741824

[git_remote]
enabled = true
commit_read_through = true

[compaction]
Expand Down
20 changes: 7 additions & 13 deletions crates/git-cache-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ pub fn app(config: AppConfig) -> Router {
}

pub fn app_result(config: AppConfig) -> CoreResult<Router> {
let git_remote_enabled = config.git_remote.enabled;
let state = Arc::new(ApiState::try_new(config)?);
router(git_remote_enabled, state)
router(state)
}

pub async fn app_result_async(config: AppConfig) -> CoreResult<Router> {
Expand All @@ -62,10 +61,9 @@ pub async fn app_result_async(config: AppConfig) -> CoreResult<Router> {
/// caller can flip during shutdown so `/healthz` starts failing and load
/// balancers stop routing new traffic while in-flight requests drain.
pub async fn app_with_shutdown_async(config: AppConfig) -> CoreResult<(Router, ReadinessGate)> {
let git_remote_enabled = config.git_remote.enabled;
let state = Arc::new(ApiState::try_new_async(config).await?);
let gate = ReadinessGate(Arc::clone(&state.shutting_down));
Ok((router(git_remote_enabled, state)?, gate))
Ok((router(state)?, gate))
}

/// Handle that marks the server as shutting down; once flipped, `/healthz`
Expand All @@ -79,20 +77,17 @@ impl ReadinessGate {
}
}

fn router(git_remote_enabled: bool, state: Arc<ApiState>) -> CoreResult<Router> {
fn router(state: Arc<ApiState>) -> CoreResult<Router> {
let git_body_limit = state.domain.config.max_git_output_bytes;
let mut router = Router::new()
let router = Router::new()
.route("/healthz", get(healthz))
.route("/metrics", get(metrics))
.route("/v1/materialize", post(materialize))
.route("/v1/resolve", post(resolve));

if git_remote_enabled {
router = router.route(
.route("/v1/resolve", post(resolve))
.route(
"/git/{*repo_path}",
any(git_repo).layer(DefaultBodyLimit::max(git_body_limit)),
);
}

Ok(router.with_state(state))
}
Expand Down Expand Up @@ -190,11 +185,10 @@ fn spawn_repo_access_flusher(domain: &Arc<AppState>) {
/// timeout, and finally any buffered repo access timestamps are flushed.
pub async fn serve(listener: tokio::net::TcpListener, config: AppConfig) -> CoreResult<()> {
let shutdown_config = config.shutdown.clone();
let git_remote_enabled = config.git_remote.enabled;
let state = Arc::new(ApiState::try_new_async(config).await?);
let domain = state.domain.clone();
let readiness = ReadinessGate(Arc::clone(&state.shutting_down));
let app = router(git_remote_enabled, state)?;
let app = router(state)?;

let readiness_delay = Duration::from_secs(shutdown_config.readiness_delay_seconds);
let drain_timeout = Duration::from_secs(shutdown_config.drain_timeout_seconds);
Expand Down
1 change: 0 additions & 1 deletion crates/git-cache-api/tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub fn test_config_with_upstream(
access_flush_interval_secs: 60,
},
git_remote: GitRemoteConfig {
enabled: true,
// Keep tests on the local read-through path regardless of the
// production proxy-on-miss default.
proxy_on_miss_by_default: false,
Expand Down
9 changes: 0 additions & 9 deletions crates/git-cache-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ impl AppConfig {
)?,
},
git_remote: GitRemoteConfig {
enabled: parse_bool_env("GIT_CACHE_GIT_REMOTE_ENABLED", true)?,
commit_read_through: parse_bool_env(
"GIT_CACHE_GIT_REMOTE_COMMIT_READ_THROUGH",
true,
Expand Down Expand Up @@ -270,8 +269,6 @@ fn default_compaction_retention_secs() -> u64 {

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct GitRemoteConfig {
#[serde(default = "default_true")]
pub enabled: bool,
#[serde(default = "default_true")]
pub commit_read_through: bool,
#[serde(default = "default_background_import_concurrency")]
Expand All @@ -288,7 +285,6 @@ pub struct GitRemoteConfig {
impl Default for GitRemoteConfig {
fn default() -> Self {
Self {
enabled: true,
commit_read_through: true,
background_import_concurrency: default_background_import_concurrency(),
proxy_on_miss_by_default: true,
Expand Down Expand Up @@ -415,7 +411,6 @@ mod tests {
"GIT_CACHE_ALLOWED_UPSTREAM_HOSTS",
"GIT_CACHE_DISK_QUOTA_BYTES",
"GIT_CACHE_DISK_MIN_FREE_BYTES",
"GIT_CACHE_GIT_REMOTE_ENABLED",
"GIT_CACHE_GIT_REMOTE_COMMIT_READ_THROUGH",
"GIT_CACHE_GIT_REMOTE_BACKGROUND_IMPORT_CONCURRENCY",
"GIT_CACHE_GIT_REMOTE_PROXY_ON_MISS_BY_DEFAULT",
Expand Down Expand Up @@ -531,7 +526,6 @@ min_free_bytes = 100000
#[test]
fn git_remote_config_default_values() {
let config = GitRemoteConfig::default();
assert!(config.enabled);
assert!(config.commit_read_through);
assert_eq!(config.background_import_concurrency, 1);
assert!(config.proxy_on_miss_by_default);
Expand All @@ -541,7 +535,6 @@ min_free_bytes = 100000
#[test]
fn git_remote_config_serde_round_trip() {
let config = GitRemoteConfig {
enabled: false,
commit_read_through: false,
background_import_concurrency: 2,
proxy_on_miss_by_default: false,
Expand All @@ -562,7 +555,6 @@ min_free_bytes = 100000
("GIT_CACHE_S3_PREFIX", "prod"),
("GIT_CACHE_S3_ENDPOINT", "https://s3.example.com"),
("GIT_CACHE_ALLOWED_UPSTREAM_HOSTS", "github.com, gitlab.com"),
("GIT_CACHE_GIT_REMOTE_ENABLED", "off"),
("GIT_CACHE_GIT_REMOTE_COMMIT_READ_THROUGH", "off"),
("GIT_CACHE_GIT_REMOTE_BACKGROUND_IMPORT_CONCURRENCY", "4"),
("GIT_CACHE_GIT_REMOTE_PROXY_ON_MISS_BY_DEFAULT", "off"),
Expand All @@ -579,7 +571,6 @@ min_free_bytes = 100000
config.allowed_upstream_hosts,
vec!["github.com".to_string(), "gitlab.com".to_string()]
);
assert!(!config.git_remote.enabled);
assert!(!config.git_remote.commit_read_through);
assert_eq!(config.git_remote.background_import_concurrency, 4);
assert!(!config.git_remote.proxy_on_miss_by_default);
Expand Down
1 change: 0 additions & 1 deletion deploy/helm/gitmirrorcache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ upstreamAuth:
| `config.objectStore.kind` | `s3` | `s3` or `local` (testing only) |
| `config.objectStore.s3.bucket` | – | Required for `s3` |
| `config.allowedUpstreamHosts` | `[github.com]` | Upstream allowlist |
| `config.gitRemote.enabled` | `true` | Serve `/git/{host}/{owner}/{repo}.git` |
| `config.disk.quotaBytes` | 100 GiB | Hot-cache disk quota |
| `persistence.size` | `100Gi` | PVC size (keep ≥ disk quota) |
| `persistence.storageClass` | `""` | PVC StorageClass; empty uses the cluster default. Use `gp3` on EKS. |
Expand Down
3 changes: 0 additions & 3 deletions deploy/helm/gitmirrorcache/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ Quick checks:
kubectl -n {{ .Release.Namespace }} port-forward svc/{{ include "gitmirrorcache.fullname" . }} 8080:{{ .Values.service.port }}
curl http://localhost:8080/healthz

{{- if .Values.config.gitRemote.enabled }}

Clone through the cache:
git clone http://localhost:8080/git/github.com/<owner>/<repo>.git
{{- end }}
{{- if and .Values.persistence.enabled (not .Values.persistence.storageClass) }}

NOTE: persistence.storageClass is empty, so the PVC relies on a cluster default
Expand Down
2 changes: 0 additions & 2 deletions deploy/helm/gitmirrorcache/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ mounts the ConfigMap) opts into it.
value: {{ .Values.config.disk.quotaBytes | int64 | quote }}
- name: GIT_CACHE_DISK_MIN_FREE_BYTES
value: {{ .Values.config.disk.minFreeBytes | int64 | quote }}
- name: GIT_CACHE_GIT_REMOTE_ENABLED
value: {{ .Values.config.gitRemote.enabled | quote }}
- name: GIT_CACHE_COMPACTION_CHAIN_DEPTH_THRESHOLD
value: {{ .Values.config.compaction.chainDepthThreshold | int64 | quote }}
- name: GIT_CACHE_COMPACTION_INLINE
Expand Down
3 changes: 0 additions & 3 deletions deploy/helm/gitmirrorcache/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ config:
disk:
quotaBytes: 107374182400 # 100 GiB; keep below the persistence size
minFreeBytes: 10737418240 # 10 GiB
gitRemote:
# Serve git clone/fetch directly via /git/{host}/{owner}/{repo}.git
enabled: true
compaction:
chainDepthThreshold: 10
inline: false
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ RUN_GITHUB_INTEGRATION=1 python3 -m unittest -v integration_tests.test_git_remot

What the tests do:

- build and start `git-cache-api` with `git_remote.enabled = true`
- build and start `git-cache-api` with the always-on `/git/` remote
- for each high-commit repo (`torvalds/linux`, `llvm/llvm-project`, `gcc-mirror/gcc`, `astral-sh/uv`):
- `git ls-remote` via the cache and compare to the upstream HEAD
- `git clone --depth 1` via the cache and verify the cloned HEAD matches upstream
Expand Down
1 change: 0 additions & 1 deletion integration_tests/test_astral_uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def setUpClass(cls) -> None:
min_free_bytes = 0

[git_remote]
enabled = true
commit_read_through = true
"""
)
Expand Down
1 change: 0 additions & 1 deletion integration_tests/test_git_remote_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def setUpClass(cls) -> None:
min_free_bytes = 0

[git_remote]
enabled = true
commit_read_through = true
"""
)
Expand Down
Loading