CI Cache

glci implements cache: via an S3-compatible endpoint on the embedded mock server, backed by a persistent container-engine volume. Cache entries survive across pipeline runs without requiring an external S3 bucket or GCS backend.

All standard cache: keywords (key, key: files:, key: prefix:, fallback_keys, paths, policy, when, untracked, multiple caches per job) work the same as production GitLab CI. See the GitLab CI caching documentation for usage details.

How it works#

Cache entries live in the CI cache volume of the daemon’s GLCI_HOME, glci-cache-<hash> (the hash is derived from the GLCI_HOME path, as for the registry volumes), so daemons with different homes on the same container engine keep separate caches. Older releases used a single glci-cache volume for every home; glci no longer reads or removes it, so the first run after upgrading starts with a cold cache, and docker volume rm glci-cache (podman volume rm glci-cache on Podman) reclaims the space. The mock server exposes S3-compatible endpoints that gitlab-runner uses via its built-in S3 cache adapter. Compression uses tarzstd at the fastest level.

When [cache] persistent = true (the default), the daemon syncs cache entries to the persistent volume at pipeline completion and preloads them into new mock server containers on the next run.

Configuration#

Configure cache behavior in .glciconfig.toml:

[cache]
persistent = true       # default; persist cache across pipeline runs
max_size = "500MB"      # reject uploads when total cache exceeds this
ttl = "24h"             # expire entries older than this duration
SettingDefaultDescription
persistenttrueSync cache entries to the persistent glci-cache-<hash> volume
max_size500MBMaximum total cache size; uploads rejected (HTTP 507) when exceeded
ttl24hTime-to-live for individual entries; expired entries are pruned on upload and rejected on download

A single cache entry is capped at 5 GB.

Clearing the cache#

# Remove all CI cache entries
glci system cache clean

This removes the glci-cache-<hash> volume of the current GLCI_HOME, and the containers that mount it; the cache of another GLCI_HOME on the same engine is left alone. The volume is recreated automatically on the next pipeline run. If the daemon is running, it is stopped and restarted automatically - unless this shell’s socket path (GLCI_HOME or GLCI_DAEMON_SOCK) is too long to restart it on, in which case glci leaves the daemon and the cache alone and says so - set GLCI_DAEMON_SOCK to the socket that daemon listens on, or run the command from the shell that started it (see Troubleshooting). A daemon that does not exit within 30 seconds of the stop also leaves the cache in place, and the command fails.

You can also clear cache as part of a broader cleanup:

# Remove unused containers, networks, volumes, and caches (not the CI cache)
glci system prune

# Remove everything including registry data, history and the CI cache
glci system prune --all

Both stop an idle daemon first and restart it after, and refuse while it runs a pipeline - see glci system prune.

Differences from production GitLab CI#

AspectglciProduction GitLab
Storage backendLocal container-engine volume via mock S3S3, GCS, or Azure (configurable per-runner)
Network latencyZero (local volume)Depends on bucket region
Cache scopeAll local pipelines share the cacheScoped by project and (optionally) protected branches
unprotectParsed but not enforced (no protected branch concept locally)Controls cache sharing between protected and unprotected branches
Size limitConfigurable via [cache] max_size (default 500 MB)Depends on storage backend
Max entry size5 GB per entryDepends on storage backend

File-based key computation uses the same MD5 algorithm as GitLab Rails, so cache keys are identical between local and production runs.

Troubleshooting#

Cache uploads rejected (507)#

The total cache size has exceeded max_size. Clear old entries:

glci system cache clean

Or increase the limit in .glciconfig.toml:

[cache]
max_size = "1GB"

Cache not persisting between runs#

Check that persistence is enabled (it is by default):

[cache]
persistent = true

If persistent = false, cache only lives for the duration of a single mock server container.

Stale cache causing build failures#

Force a clean run:

glci system cache clean
glci run
Esc