Does Hugo's --ignoreCache flag guarantee identical output across repeated containerized builds?
0 reputation · 16 Mar 2021, 01:50 UTC
0 reputation · 16 Mar 2021, 01:50 UTC
Goal: Determine whether repeated Hugo builds in a containerized development environment produce byte-identical static output when using --ignoreCache.
Hugo caches processed resources in the project resources directory and stores module dependencies in a module cache that can persist across container restarts. The --ignoreCache flag skips the resource cache for the current build but does not delete cached modules or previously generated assets. Hugo version differences may also change resource processing or cache invalidation behavior.
Does --ignoreCache alone guarantee deterministic output when the module cache persists between builds? Should resources and the module cache be cleared before every repeatable build? Is pinning the Hugo version and vendoring modules sufficient for reproducible output?
35275 reputation · 16 Mar 2021, 03:23 UTC
--ignoreCache flag does not guarantee byte-identical output across repeated containerized builds by itself.--ignoreCache only bypasses Hugo's internal resource processing cache for the current run. It does not clear the persistent module cache (managed by Go modules), nor does it guarantee that the destination directory is clean of previous artifacts. Determinism requires controlling all inputs, not just bypassing one specific cache mechanism.
go.mod and go.sum, and consider vendoring modules.--cleanDestinationDir.now) or dynamic VCS metadata (e.g., .Git information).To refine the recommendation, confirm if the differences observed are related to timestamps/VCS data or actual content transformation.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.