Repository navigation
CNTRLPLANE-3945: Migrate documentation tooling from mkdocs-material to zensical #9139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,21 @@ | ||
| RUNTIME ?= $(shell sh ../hack/utils.sh get_container_engine) | ||
| version := $(shell awk -f image-version.awk requirements.txt) | ||
| VERSION ?= $(if $(MKDOCS_TAG),$(MKDOCS_TAG),$(version)) | ||
| IMG ?= quay.io/hypershift/mkdocs-material:$(VERSION) | ||
| IMG ?= docker.io/zensical/zensical:0.0.51 | ||
|
|
||
| .PHONY: build | ||
| build: | ||
| mkdocs build | ||
| uv run --frozen zensical build --strict | ||
|
|
||
| .PHONY: build-containerized | ||
| build-containerized: | ||
| $(RUNTIME) volume create --ignore hypershift-docs-site | ||
| $(RUNTIME) run --rm -it \ | ||
| -v ${PWD}:/home/docs/hypershift:Z \ | ||
| -v hypershift-docs-site:/home/docs/hypershift/site \ | ||
| -v ${PWD}:/docs:Z \ | ||
| -v hypershift-docs-site:/docs/site \ | ||
| $(IMG) build --strict | ||
|
|
||
| .PHONY: serve-containerized | ||
| serve-containerized: | ||
| $(RUNTIME) run --rm -it -p 8000:8000 \ | ||
| -v ${PWD}:/home/docs/hypershift:Z \ | ||
| -v hypershift-docs-site:/home/docs/hypershift/site \ | ||
| $(IMG) serve --dev-addr 0.0.0.0:8000 | ||
|
|
||
| .PHONY: image | ||
| image: | ||
| $(RUNTIME) build -t $(IMG) . | ||
|
|
||
| .PHONY: push | ||
| push: | ||
| $(RUNTIME) push $(IMG) | ||
| -v ${PWD}:/docs:Z \ | ||
| -v hypershift-docs-site:/docs/site \ | ||
| $(IMG) | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,49 +2,39 @@ Any changes to the docs in this directory can be tested locally before pushing c | |||||||||
| steps: | ||||||||||
|
|
||||||||||
| 1. cd to this directory | ||||||||||
| 2. Run `make image` to build the image | ||||||||||
| 3. Run `make build-containerized` to build the containerized version of the image | ||||||||||
| 4. Run `make serve-containerized` to serve up the docs website locally | ||||||||||
| 2. Run `make build-containerized` to build the containerized version of the image | ||||||||||
| 3. Run `make serve-containerized` to serve up the docs website locally | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Renumber the setup commands. After removing the Proposed fix-2. Run `make build-containerized` to build the containerized version of the image
-3. Run `make serve-containerized` to serve up the docs website locally
+1. Run `make build-containerized` to build the containerized version of the image
+2. Run `make serve-containerized` to serve up the docs website locally📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| Any changes you make while the docs are served locally, will be updated in the local docs website. | ||||||||||
|
|
||||||||||
| ## Managing Python dependencies | ||||||||||
| ## Configuration | ||||||||||
|
|
||||||||||
| The site configuration lives in `mkdocs.yml`. Zensical still uses the MkDocs | ||||||||||
| configuration format; once Zensical ships a migration tool for its native TOML | ||||||||||
| config, we will switch over. | ||||||||||
|
|
||||||||||
| `requirements.txt` pins every Python dependency needed to build the docs | ||||||||||
| (mkdocs and its plugins) to an exact version and includes | ||||||||||
| `--hash=sha256:...` entries for each published artifact, enabling pip's | ||||||||||
| hash-checking mode (`pip install --require-hashes`). This is what | ||||||||||
| `.github/workflows/docs-build-reusable.yaml` installs before running | ||||||||||
| `mkdocs build --strict`. | ||||||||||
| ## Managing Python dependencies | ||||||||||
|
|
||||||||||
| Because hash-checking mode requires every installed package — including | ||||||||||
| transitive dependencies of mkdocs-material, mkdocs-mermaid2-plugin, and | ||||||||||
| mkdocs-glightbox — to be pinned and hashed, the file lists the full resolved | ||||||||||
| dependency closure, not just the three plugins imported directly. | ||||||||||
| Dependencies are declared in `pyproject.toml` and locked with | ||||||||||
| [`uv`](https://docs.astral.sh/uv/) into `uv.lock`, which pins every | ||||||||||
| direct and transitive package to an exact version with hash verification | ||||||||||
| for supply chain security. This is what | ||||||||||
| `.github/workflows/docs-build-reusable.yaml` uses when running | ||||||||||
| `uv run --frozen zensical build --strict`. | ||||||||||
|
|
||||||||||
| ### Adding or updating a dependency | ||||||||||
|
|
||||||||||
| 1. Add or update the package's version constraint in `requirements.txt` | ||||||||||
| (e.g. `newplugin>=1.0.0`, or bump an existing `==` pin). | ||||||||||
| 2. Regenerate the file with [`uv`](https://docs.astral.sh/uv/), compiling to | ||||||||||
| a new temporary path rather than overwriting `requirements.txt` directly, | ||||||||||
| then move it into place: | ||||||||||
| 1. Add or update the package in `pyproject.toml` | ||||||||||
| (e.g. add `"newplugin>=1.0.0"` to `dependencies`, or bump an existing pin). | ||||||||||
| 2. Regenerate the lockfile: | ||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| uv pip compile --generate-hashes docs/requirements.txt -o /tmp/requirements.txt.new | ||||||||||
| mv /tmp/requirements.txt.new docs/requirements.txt | ||||||||||
| uv lock | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| This resolves the full dependency graph, pins every package (direct and | ||||||||||
| transitive) to an exact version, and adds `--hash=sha256:...` entries for | ||||||||||
| all of its published wheel/sdist artifacts. Don't edit hashes by hand — | ||||||||||
| always regenerate so they're guaranteed to match the published artifact. | ||||||||||
| 3. Validate the result, forcing pip to actually verify every package's hash | ||||||||||
| rather than skipping ones already present locally: | ||||||||||
| 3. Confirm the docs still build: | ||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| pip install --dry-run --ignore-installed --require-hashes -r docs/requirements.txt | ||||||||||
| uv run --frozen zensical build --strict | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| 4. Confirm the docs still build: `cd docs && mkdocs build --strict` | ||||||||||
| (after installing the regenerated requirements into your environment). | ||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [project] | ||
| name = "hypershift-docs" | ||
| version = "0.1.0" | ||
| description = "HyperShift documentation" | ||
| readme = "README.md" | ||
| requires-python = ">=3.12" | ||
| dependencies = ["zensical==0.0.51"] |
Uh oh!
There was an error while loading. Please reload this page.