Skip to content

Commit 912372a

Browse files
HoustonPutmanclaude
andcommitted
Generate antora.yml for local builds; keep committed file release-managed
Follow up from #834 The committed docs/antora.yml is what the published Reference Guide uses for a branch, so it must reflect that branch's released version (not a prerelease) and should only change at release time. Previously `make docs` and propagate_version.sh regenerated it from version/version.go on every run, leaving release branches showing a prerelease version. Mirror Solr's approach: - `make docs`/`check-docs` now stage a build dir (docs/build/staging) with a throwaway antora.yml generated from version/version.go, so local previews show the in-development version without touching the committed file. - generate_antora_yaml.sh takes -o (output) for staging. - Remove antora.yml regeneration from propagate_version.sh; the release wizard regenerates the committed docs/antora.yml at release (after the prerelease suffix is stripped), so it reflects the released version. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 681332a commit 912372a

5 files changed

Lines changed: 56 additions & 20 deletions

File tree

Makefile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,27 @@ helm-deploy-operator: helm-dependency-build docker-build ## Deploy the current v
344344
# for local previewing only; the official site is published as an additional
345345
# component of the Reference Guide from the apache/solr repo.
346346
ANTORA_IMAGE ?= antora/antora:3.1.12
347+
DOCS_STAGING = docs/build/staging
347348

348349
.PHONY: generate-antora-yaml
349-
generate-antora-yaml: ## Generate docs/antora.yml from version/version.go
350+
# Writes the COMMITTED docs/antora.yml. This descriptor drives the published
351+
# site for this branch, so it is only run at release time (by the release
352+
# wizard) to reflect the released version -- NOT on every local build.
353+
generate-antora-yaml: ## Regenerate the committed docs/antora.yml (release use)
350354
./hack/docs/generate_antora_yaml.sh
351355

356+
.PHONY: docs-staging
357+
# Stages a build dir with the modules and a throwaway antora.yml generated from
358+
# version/version.go, so local previews show the in-development version without
359+
# modifying the committed docs/antora.yml.
360+
docs-staging:
361+
rm -rf $(DOCS_STAGING)
362+
mkdir -p $(DOCS_STAGING)
363+
cp -r docs/modules $(DOCS_STAGING)/modules
364+
./hack/docs/generate_antora_yaml.sh -o $(DOCS_STAGING)/antora.yml
365+
352366
.PHONY: docs
353-
docs: generate-antora-yaml ## Build the operator Antora docs site locally for previewing (requires Docker)
367+
docs: docs-staging ## Build the operator Antora docs site locally for previewing (requires Docker)
354368
docker run --rm -v "$(PROJECT_DIR):/antora" -w /antora/docs $(ANTORA_IMAGE) --fetch --to-dir build/site local-playbook.yml
355369
@echo "Docs built. Open docs/build/site/index.html in a browser to preview."
356370

@@ -359,7 +373,7 @@ docs-clean: ## Remove the locally-generated documentation site
359373
rm -rf docs/build
360374

361375
.PHONY: check-docs
362-
check-docs: generate-antora-yaml ## Validate the operator docs build with no broken references (requires Docker)
376+
check-docs: docs-staging ## Validate the operator docs build with no broken references (requires Docker)
363377
docker run --rm -v "$(PROJECT_DIR):/antora" -w /antora/docs $(ANTORA_IMAGE) --fetch --log-failure-level=warn --to-dir build/site local-playbook.yml
364378

365379
##@ Dependencies

docs/local-playbook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ content:
3737
- url: ..
3838
# HEAD builds the current worktree, including uncommitted changes.
3939
branches: HEAD
40-
start_path: docs
40+
start_path: docs/build/staging
4141
# No "edit this page" links in local preview.
4242
edit_url: false
4343

hack/docs/generate_antora_yaml.sh

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,43 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# Generates docs/antora.yml from docs/antora.template.yml, deriving the Antora
18-
# component version from version/version.go. This keeps the Antora version in
19-
# lock-step with the operator version without requiring Gradle (unlike Solr).
17+
# Generates an Antora component descriptor (antora.yml) for the operator docs
18+
# from docs/antora.template.yml, deriving the version from version/version.go.
2019
#
21-
# v0.10.0 (suffix "") -> version '0_10', display_version '0.10'
22-
# v0.10.0 (suffix "prerelease") -> version '0_10', display_version '0.10-prerelease', prerelease: -prerelease
20+
# By default it writes the COMMITTED docs/antora.yml -- the descriptor the
21+
# published Reference Guide uses for this branch. The release wizard regenerates
22+
# it (via `make generate-antora-yaml`) at the steps where the published version
23+
# changes; it is deliberately NOT regenerated on the post-release patch bump, so
24+
# a release branch stays pinned to its last released version. Local preview
25+
# builds (`make docs`) pass -o to write a throwaway descriptor into the
26+
# build/staging directory, so the committed file is never modified during a
27+
# normal build.
28+
#
29+
# Usage: generate_antora_yaml.sh [-o OUTPUT]
30+
# -o OUTPUT output file (default: docs/antora.yml)
31+
#
32+
# version.go v0.9.1 -> version '0_9', display_version 'v0.9'
33+
# version.go v0.10.0 (prerelease) -> version '0_10', display_version 'v0.10-prerelease', prerelease: -prerelease
2334

2435
set -eu
2536
set -o pipefail
2637

27-
# Resolve the project root (this script lives in hack/docs/).
2838
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2939
PROJECT_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd)"
30-
31-
VERSION_GO="${PROJECT_DIR}/version/version.go"
3240
TEMPLATE="${PROJECT_DIR}/docs/antora.template.yml"
3341
OUTPUT="${PROJECT_DIR}/docs/antora.yml"
3442

35-
# Parse Version (e.g. v0.10.0) and VersionSuffix (e.g. prerelease) from version.go.
43+
while getopts ":o:" opt; do
44+
case "${opt}" in
45+
o) OUTPUT="${OPTARG}" ;;
46+
*) echo "Usage: $0 [-o OUTPUT]" >&2; exit 2 ;;
47+
esac
48+
done
49+
50+
VERSION_GO="${PROJECT_DIR}/version/version.go"
3651
RAW_VERSION="$(grep -E 'Version([[:space:]]+)=' "${VERSION_GO}" | head -1 | sed -E 's/.*["'"'"']([^"'"'"']*)["'"'"'].*/\1/')"
3752
SUFFIX="$(grep -E 'VersionSuffix([[:space:]]+)=' "${VERSION_GO}" | sed -E 's/.*["'"'"']([^"'"'"']*)["'"'"'].*/\1/')"
3853

39-
# Strip leading 'v' and split into semver parts.
4054
SEMVER="${RAW_VERSION#v}"
4155
IFS='.' read -r MAJOR MINOR PATCH <<< "${SEMVER}"
4256

@@ -51,6 +65,7 @@ else
5165
PRERELEASE_LINE=""
5266
fi
5367

68+
mkdir -p "$(dirname "${OUTPUT}")"
5469
# Substitute tokens. Use '|' as the sed delimiter; values contain no '|'.
5570
sed \
5671
-e "s|@ANTORA_VERSION@|${ANTORA_VERSION}|g" \

hack/release/version/propagate_version.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,4 @@ fi
9898
} > helm/solr/README.md.tmp && mv helm/solr/README.md.tmp helm/solr/README.md
9999

100100

101-
# Regenerate the operator Antora component descriptor (docs/antora.yml) from
102-
# version/version.go. Docs pages reference the version via the {operator-version}
103-
# attribute defined there, so no per-page version edits are needed.
104-
./hack/docs/generate_antora_yaml.sh
105-
106101
make manifests

hack/release/wizard/releaseWizard.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ groups:
458458
- !Command
459459
cmd: make propagate-version
460460
tee: true
461+
- !Command
462+
cmd: make generate-antora-yaml
463+
comment: Regenerate the committed docs/antora.yml for the new version.
464+
tee: true
461465
- !Command
462466
comment: Make sure the edits done by propagating the version are ok, then push
463467
cmd: git add -u . && git commit -m "Add next major version {{ next_version }}" && git push
@@ -490,6 +494,10 @@ groups:
490494
- !Command
491495
cmd: make propagate-version
492496
tee: true
497+
- !Command
498+
cmd: make generate-antora-yaml
499+
comment: Regenerate the committed docs/antora.yml for the new version.
500+
tee: true
493501
- !Command
494502
comment: Make sure the edits done by propagating the version are ok, then push
495503
cmd: git add -u . && git commit -m "Add next minor version {{ next_version }}" && git push
@@ -755,10 +763,14 @@ groups:
755763
comment: Remove the prerelase suffix from the version.
756764
stdout: true
757765
- !Command
758-
cmd: ./hack/release/version/propagate_version.sh
766+
cmd: make propagate-version
759767
comment: Propagate the new version throughout the repo.
760768
logfile: propagate_version.log
761769
tee: true
770+
- !Command
771+
cmd: make generate-antora-yaml
772+
comment: Regenerate the committed docs/antora.yml to the released version.
773+
tee: true
762774
- !Command
763775
cmd: ./hack/release/artifacts/set_signing_key.sh -f "{{ gpg_fingerprint | default('<gpg_fingerprint>', True) }}"
764776
comment: Set the signing key throughout the repo.

0 commit comments

Comments
 (0)