Skip to content
Open
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
24 changes: 24 additions & 0 deletions website/docs/guides/remote-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,30 @@ Remote cache latency (fastest first):
The `[rw]` flags show the configured `read`/`write` permissions. The order
is persisted and reused automatically until the cache definitions change.

## Excluding targets from the remote cache

Some targets produce outputs that embed host-local paths — a wrapper script
that references an absolute path in a local toolchain store, for example.
Sharing those artifacts causes another machine to pull a wrapper that points
at a path it doesn't have, which fails at run time.

Set `cache = {"remote": False}` on those targets. Local caching stays on;
heph will never upload the artifact to or download it from a remote cache:

```python title="BUILD"
target(
name = "local-wrapper",
driver = "exec",
run = ["./gen-wrapper.sh"],
out = "wrapper.sh",
cache = {"remote": False},
)
```

Every machine builds its own copy and caches it locally. Targets that depend
on it get a local hit on the same machine; other machines build their own copy
on first use.

## In CI

A typical CI setup: grant write access to CI runners and read access
Expand Down
31 changes: 30 additions & 1 deletion website/docs/plugins/exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The following target config keys are available:
| `pass_env` | Host vars passed at parse time and hashed into the cache key. Accepts `["*"]` to pass all. |
| `runtime_pass_env` | Host vars passed at run time only, not hashed. Accepts `["*"]` to pass all. |
| `runtime_env` | Runtime literal environment variables. |
| `cache` | Bool or `{enabled, remote, history}`. |
| `cache` | `True`/`False` toggles local + remote together; dict: `{enabled, remote, history}`. |
| `codegen` | Write generated outputs into the source tree (`copy` or `in_place`). |

These environment variables are available inside the sandbox:
Expand Down Expand Up @@ -202,6 +202,35 @@ target(
)
```

## Cache control

`cache` accepts a bare bool or a dict with up to three keys:

| Key | Type | Default | Meaning |
|-----|------|---------|---------|
| `enabled` | bool | `true` | Enable local caching for this target. |
| `remote` | bool | `true` | Enable remote caching for this target. Set `false` when outputs embed host-local paths that cannot be safely shared across machines. |
| `history` | int | `1` | Number of past revisions to retain in the local cache (minimum `1`). |

A bare `True` sets both `enabled` and `remote` to `true`. A bare `False` disables both.

Use `cache = {"remote": False}` to keep local caching on but opt a specific
target out of remote push and pull — useful for targets whose outputs reference
paths that only exist on the machine that built them:

```python title="BUILD"
target(
name = "wrapper",
driver = "exec",
run = ["./gen-wrapper.sh"],
out = "wrapper.sh",
cache = {"remote": False},
)
```

The target still builds and caches locally; it is never uploaded to or pulled
from a remote cache.

## Interactive debugging with `--shell`

When a target fails, drop into its sandbox with the exact inputs, tools, and
Expand Down
Loading