fix(build): preserve per-version assets when deduplicating (fixes unstyled non-latest doc versions)#73
Merged
maksimzinchuk merged 1 commit intoJun 4, 2026
Conversation
deduplicate_assets replaced every nested assets/ folder with a symlink to the root assets/. Material uses content-hashed asset filenames, and a mike version built with a different Material release carries a different hash. Symlinking those folders to the current-build root assets/ hid older versions' stylesheets, so their pages referenced a hash that no longer existed in the image and rendered unstyled (e.g. platform/user-guide/2.0). Only deduplicate a nested assets/ folder when all of its files are present in the root assets/; otherwise keep it as real files. This keeps the space savings for same-build subsites while preserving version-specific assets across Material upgrades. Refs VirtoCommerce/vc-github-actions#247
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Non-latest mike doc versions lost all styling in prod (e.g.
https://docs.virtocommerce.org/platform/user-guide/2.0/). Their HTML referenced a content-hashed stylesheet (main.484c7ddc.min.css) that was absent from the image, so the server returned the SPA/index fallback (200+content-type: text/html) and the browser ignored it as CSS.Root cause
versioned-build-cicd.py→deduplicate_assets()replaced every nestedassets/folder with a symlink to the rootassets/(the current build, e.g. hash6543a935).Material uses content-hashed asset filenames. A mike version built earlier with a different Material release carries a different hash. Symlinking that version's
assets/to the current-build rootassets/hid its stylesheets, so its pages pointed at a hash that no longer existed → unstyled pages.This is also why a future
mkdocs-materialbump onmainwould silently re-break every older version: amaindeploy rebuilds only the latest version, but the dedup step collapses all versions onto the new root hash.Fix
Only deduplicate a nested
assets/folder when all of its files are also present in the rootassets/. Folders with version-specific files (an older Material build's hashed assets) are kept as real files.Verification
Unit-tested the function on a synthetic tree (root + a same-hash 3.0 folder + an old-hash 2.0 folder):
assets/→ symlinked (deduplicated) ✅assets/→ kept as real files; old-hash CSS still present ✅assets/intact ✅All three live versions (1.0/2.0/3.0) currently serve
content-type: text/cssafter the manual per-branch redeploys; this change makes that resilient to future Material upgrades without per-branch redeploys.Refs VirtoCommerce/vc-github-actions#247