How To: Run Incremental Builds
Incremental builds avoid recloning repositories and only fetch updates, saving time and bandwidth.
Choose a Clone Strategy
Set in build.clone_strategy:
fresh: Always reclone (slowest, cleanest).update: Always attempt fast-forward/hard reset existing clones.auto: (Recommended) Useupdateif the directory exists elsefresh.
Example:
Persisting Workspaces
To persist clones across runs, either:
- Leave
workspace_dirunset and keepclone_strategyatauto(default resolves a stable path), or - Explicitly set
build.workspace_dirto a persistent location.
Handling Divergence
If local branches diverge (e.g., manual changes), enable hard reset:
Without this flag divergence becomes a reported issue (REMOTE_DIVERGED).
Cleaning Untracked Files
Enable to remove stray generated or stale files after updates:
Shallow Clones
Use shallow_depth to limit history and speed up fetches:
Detecting No-Op Builds
The build log will emit:
No repository head changes detected(all repos unchanged)Documentation files unchanged(doc file set identical)
You can also compare doc_files_hash in successive build-report.json files.
CI Optimization Pattern
Pseudocode:
Retry Behavior
Transient clone/update failures (network flake, intermittent Hugo issues) can be retried with backoff:
Permanent failures (auth, repo not found, unsupported protocol) short‑circuit retries and surface granular issue codes.
Summary
Use clone_strategy: auto, shallow depth, and hash comparison to keep builds fast and conditional.