Object Storage Cache
Share Struo cache results across machines and CI through an Amazon S3, Google Cloud Storage, Azure Blob Storage, or S3-compatible bucket, with no cache server.
Every machine keeps its local cache, consults the bucket on a local miss, and publishes new results to it. Use it for teams and CI fleets that already have a bucket, for a self-hosted cache, or to try shared caching without an account.
Capabilities#
| Capability | Support |
|---|---|
| Shared cache | Yes |
| Remote execution | No; use an execution provider |
| Artifact publication | No |
| Project setup | Manual configuration |
| Authentication | Each cloud's credential chain |
Automated checks use local emulators; live cloud services are unverified.
Prerequisites#
Create a bucket or container in Amazon S3, Google Cloud Storage, Azure Blob Storage, or an API-compatible service. A local or mounted directory also works. Give trusted clients read/write access and untrusted jobs read-only access. Configure retention in the storage service.
Configuration#
Name the bucket in the repository root struo.toml:
[infrastructures.team_cache]
kind = "object_store"
url = "s3://acme-build-cache/struo"
[infrastructure.cache]
provider = "team_cache"The URL scheme selects the service, and the path after the bucket is a prefix Struo writes under:
| URL | Service |
|---|---|
s3://bucket/prefix | Amazon S3 and S3-compatible services |
gs://bucket/prefix | Google Cloud Storage |
az://container/prefix | Azure Blob Storage |
file:///absolute/directory | A local or mounted directory |
Keep credentials out of the URL. Struo rejects passwords, queries, and
fragments, and permits a user-name component only for Azure's
abfss://container@account.dfs.core.windows.net/prefix container syntax
and its az:// and abfs:// equivalents.
options passes service settings, such as an endpoint or region:
[infrastructures.team_cache]
kind = "object_store"
url = "s3://acme-build-cache/struo"
options = { endpoint = "https://ACCOUNT_ID.r2.cloudflarestorage.com", region = "auto" }Option names follow the configuration keys of the Rust object_store library,
with or without their aws_, google_, or azure_ prefix, plus profile for
S3 (see Authentication). Unknown names are rejected. Credential
options, such as secret_access_key or account_key, are also rejected so
that secrets never land in a configuration file; set them in the environment
instead. Options that only point at credentials, such as a token file path or a
metadata endpoint URI, are allowed.
The same kind = "object_store" table works in ~/.config/struo/config.toml
for a personal default, and as [cache_provider] with kind = "object_store"
for a single workspace.
Authentication#
Struo reads credentials from the environment variables and ambient identity each service's own tools use:
- Amazon S3 and compatible services: the AWS SDK's default credential
chain, the same one the AWS CLI uses. It reads, in order:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, andAWS_SESSION_TOKEN; the profile named byAWS_PROFILE(ordefault) in~/.aws/configand~/.aws/credentials, including IAM Identity Center (SSO) sessions,credential_processhelpers, and roles assumed from a source profile; web identity throughAWS_WEB_IDENTITY_TOKEN_FILEandAWS_ROLE_ARN, which covers GitHub Actions and other CI OpenID Connect federation; ECS and EKS container credentials; and the EC2 instance metadata service. Temporary credentials are renewed five minutes before they expire. - Google Cloud Storage:
GOOGLE_SERVICE_ACCOUNTorGOOGLE_APPLICATION_CREDENTIALSnaming a key file, the application default credentials thatgcloud auth application-default loginwrites, and the metadata server on Google Cloud. - Azure Blob Storage:
AZURE_STORAGE_ACCOUNT_NAMEwithAZURE_STORAGE_ACCOUNT_KEY, a SAS token inAZURE_STORAGE_SAS_TOKEN, a service principal throughAZURE_CLIENT_ID,AZURE_CLIENT_SECRET, andAZURE_TENANT_ID, workload identity throughAZURE_FEDERATED_TOKEN_FILE, managed identity, or the Azure CLI whenuse_azure_cli = "true".
To pin a profile for a provider instead of relying on AWS_PROFILE, set it
in options:
[infrastructures.team_cache]
kind = "object_store"
url = "s3://acme-build-cache/struo"
options = { profile = "build-cache" }When neither options nor AWS_REGION sets a region, Struo uses the
profile's region. For an SSO profile, sign in with aws sso login --profile <name> first; Struo reuses the cached session but does not open a browser. An
expired session is reported like an outage: actions run locally and a warning
says why.
Setting skip_signature, role_arn, web_identity_token_file, or a
container or metadata endpoint in options switches S3 back to the storage
library's own credential lookup, which does not read ~/.aws profiles; such
options cannot be combined with profile.
Usage#
Run cacheable scripts or builds as usual. To verify sharing, use a second client with an empty local cache and the same configuration and inputs. A successful write or a hit from the first client's local cache does not prove remote reuse.
Restrict untrusted jobs#
Content is verified against its digest before Struo uses it, but an action result is a record whose correctness Struo cannot check. Anyone who can write to the bucket can publish a result that other machines reuse. Give untrusted jobs, such as pull requests from forks, read-only credentials, and make Struo stop publishing for them:
[infrastructures.team_cache]
kind = "object_store"
url = "s3://acme-build-cache/struo"
read_only = trueSetting STRUO_CACHE_READ_ONLY=1 has the same effect for one invocation on the
object storage cache. It does not disable Tuist uploads. The environment can
only make access narrower; it cannot turn publishing back on for a provider
configured with read_only = true.
Limits and cleanup#
Retention#
Struo never deletes objects from the bucket. Local garbage collection and
struo cache action forget affect only the local cache. Configure retention
in the storage service, for example a lifecycle rule that expires objects
under the prefix after 30 days and aborts incomplete multipart uploads after
one day.
Expiring content is safe. A shared result whose referenced content has been deleted is treated as a miss, and Struo runs the action again.
Failures#
- Unreachable or throttled service: each request retries up to three times within 30 seconds. After that, the action runs locally and the result is kept in the local cache.
- Missing or rejected credentials, or denied access: the command fails
rather than silently running without the shared cache. This includes an S3
profile that does not exist or no credentials anywhere in the AWS chain. Fix
the credentials, or set
STRUO_CACHE_PROVIDER=localto bypass the bucket for one invocation. An explicit STS authentication or role-permission refusal also fails the command rather than falling back to local execution, as do rejected Azure or Google OAuth token exchanges. - Unreachable credential source: when the source exists but cannot answer, such as the SSO portal or STS while offline, or when an SSO session has expired, the action runs locally. The warning gives safe recovery guidance; credential helper output, including Azure CLI stderr, and raw provider diagnostic details are not logged because they can contain secrets.
- Corrupt or truncated content: it is rejected before it enters the local cache, and the command reports the corruption.
Publishing is best effort. A failed upload is logged as a warning, and the command still succeeds with its local result.
Service compatibility#
The s3://, gs://, and az:// backends use each service's REST API, so any
service implementing that API with standard request signing is expected to
work. Automated checks cover S3 through moto, Azure through Azurite, and local
directories. Live Amazon S3, Google Cloud Storage, Azure and S3-compatible
services have not been verified. This includes Cloudflare R2, MinIO, Backblaze
B2, Wasabi, DigitalOcean Spaces, Tigris and Ceph RGW. Validate your chosen
service and authentication method before relying on it.
Some S3-compatible services need virtual_hosted_style_request = "true" or a
specific region, such as auto for Cloudflare R2. Plain HTTP endpoints, such
as a local MinIO, need allow_http = "true".
Storage limits#
- Content is stored uncompressed, so transfer and storage costs match the raw size of outputs.
- Each download makes a metadata request before fetching the body, and each remote result lookup makes one existence check per referenced blob not already held locally. Request-priced services charge for each.
- A standalone stream larger than 8 MiB, such as a large log written outside an action result, stays local until an action result that references it is published.
- Isolation is whatever the bucket's access policy provides. Use a separate bucket or prefix with its own credentials for each trust boundary.
- A
file://store on a network filesystem is only as safe for concurrent writers as that filesystem's rename.
Next steps#
- HTTP Build Cache: use a WebDAV or HTTP cache your CI runners already reach instead.
- Cache provider contract: see the exact layout Struo writes to the bucket.
- Remote Execution: run actions on another machine and reuse their results through this cache.