Before a pipeline starts anything, EZGH Build computes a key for each task. When a task with the
same key has already succeeded for the connection, the task is cached: it counts as succeeded and
nothing runs.
The key
A task’s key is a hash of:
- the task’s definition:
runorbuild,env, the image’s digest,bot, the names of itssecrets,bucketsandclusters,outputsandwarmpaths; - each input file: its path, mode and content hash;
- the key of every task it needs.
Not in the key:
size,disk_gib,timeoutandonly. Changing them reruns nothing.- Secret values. Rotating a secret reruns nothing.
- Files that
inputsdoesn’t match. They aren’t in/workspaceeither, so a task can’t read a repository file that its key doesn’t cover.
A task with cache: false has no key and always runs, and so does every task that needs it.
A reused result
A cached task:
- reports its check as passed, saying which pipeline’s result it reuses, with that run’s log;
- has its
outputsrestored into the tasks that need it; - for a
buildtask, applies this commit’s tags to the image it built before.
Only succeeded tasks are reused. A failed task runs again.
On a task’s page the console says why a task ran: no earlier run, definition changed,
inputs changed, or <task> changed for a task it needs.
Trusted refs
A connection has trusted refs, by default its default branch. Each
result is stored with a scope: trusted, or the ref it ran on.
| A pipeline on | Reads | Writes |
|---|---|---|
| A trusted ref | trusted results |
trusted results |
| Any other ref | trusted results and its own ref’s |
Its own ref’s |
So a result written on a feature branch is never used on main.
Warm paths
warm paths hold what makes a task faster and doesn’t change its result, such as a compiler or
package cache. They are restored from the newest trusted run of the same task and saved again only
by trusted runs. They are never part of the key.
What the key can’t see
A task’s key covers the repository files it lists, its definition and what it needs. It doesn’t
cover what a script reads from elsewhere: the network, a moving tag in a Dockerfile’s FROM, the
clock. A task whose result depends on those takes cache: false.
The image named in image is in the key by its digest, so a tag that moves reruns the task.
cache must be written, true or false, on every task that names clusters: a deploy says
whether it may be skipped.
Storage
Results are stored in the project’s Container Registry, in the repository
ezgh-build/cache. A task’s outputs are limited to 2 GiB, and so are its warm paths. Results
unused for 14 days are removed.
Rerun with “Run every task again, ignoring earlier results”, ezgh build rerun --no-cache and
ezgh build run --no-cache run every task.