Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (68 loc) · 3.47 KB
/
Copy pathMakefile
File metadata and controls
87 lines (68 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
pages := $(shell find . -type f -name '*.adoc')
web_dir := ./_public
# Determine whether to use podman
#
# podman currently fails when executing in GitHub actions on Ubuntu LTS 20.04,
# so we never use podman if GITHUB_ACTIONS==true.
use_podman := $(shell command -v podman 2>&1 >/dev/null; p="$$?"; \
if [ "$${GITHUB_ACTIONS}" != "true" ]; then echo "$$p"; else echo 1; fi)
ifeq ($(use_podman),0)
engine_cmd ?= podman
engine_opts ?= --rm --tty --userns=keep-id
else
engine_cmd ?= docker
engine_opts ?= --rm --tty --user "$$(id -u)"
endif
orphans_cmd ?= $(engine_cmd) run $(engine_opts) --volume "$${PWD}:/antora" ghcr.io/vshn/antora-nav-orphans-checker:1.1 -antoraPath /antora/docs
vale_cmd ?= $(engine_cmd) run $(engine_opts) --volume "$${PWD}"/docs/modules/ROOT/pages:/pages --workdir /pages ghcr.io/vshn/vale:2.15.5 --minAlertLevel=error .
preview_cmd ?= $(engine_cmd) run --rm --publish 35729:35729 --publish 2020:2020 --volume "${PWD}":/preview/antora ghcr.io/vshn/antora-preview:3.1.4 --antora=docs --style=vshn
antora_cmd ?= $(engine_cmd) run $(engine_opts) --volume "$${PWD}":/antora ghcr.io/vshn/antora:3.1.2.2
# The search index is built into the site, so search runs in the reader's browser rather than in
# a container. pagefind_runner is emptied where npx is already available, such as inside the
# Antora image the container build runs in.
# renovate: datasource=npm depName=pagefind
pagefind_VERSION ?= 1.5.2
pagefind_runner ?= $(engine_cmd) run $(engine_opts) --volume "$${PWD}":/antora --workdir /antora ghcr.io/vshn/antora:3.1.14.1
pagefind_cmd ?= $(pagefind_runner) npx --yes pagefind@$(pagefind_VERSION) --site $(web_dir)
antora_opts ?= --cache-dir=.cache/antora
.PHONY: all
all: preview
.PHONY: check
check:
$(orphans_cmd)
$(vale_cmd)
.PHONY: preview
preview:
$(preview_cmd)
.PHONY: html
html: $(web_dir)/index.html
$(web_dir)/index.html: playbook.yml $(pages)
$(antora_cmd) $(antora_opts) $<
$(pagefind_cmd)
## CRD API doc generator
go_bin ?= $(PWD)/.work/bin
$(go_bin):
@mkdir -p $@
crd_ref_docs_bin ?= $(go_bin)/crd-ref-docs
$(crd_ref_docs_bin): export GOBIN = $(go_bin)
$(crd_ref_docs_bin): | $(go_bin)
go install github.com/elastic/crd-ref-docs@latest
crd_branch ?= master
clone-crds:
rm -rf .work/crds
git clone https://github.com/vshn/appcat/ .work/crds
cd .work/crds && git checkout $(crd_branch)
.PHONY: docs-generate-api
docs-generate-api: $(crd_ref_docs_bin) ## Generates API reference documentation
docs-generate-api: clone-crds
$(crd_ref_docs_bin) --source-path=.work/crds/apis/v1 --config=generator/api-gen-config.yaml --renderer=asciidoctor --templates-dir=generator/api-templates --output-path=docs/modules/ROOT/pages/references/crds.adoc
$(crd_ref_docs_bin) --source-path=.work/crds/apis/vshn/v1 --config=generator/api-gen-config.yaml --renderer=asciidoctor --templates-dir=generator/api-templates --output-path=docs/modules/ROOT/pages/references/crds_vshn.adoc
# a bit hacky, but the tool doesn't support multiple api groups with one call...
cat docs/modules/ROOT/pages/references/crds_vshn.adoc | sed "s/= API Reference/== VSHN Reference/g" >> docs/modules/ROOT/pages/references/crds.adoc
rm docs/modules/ROOT/pages/references/crds_*.adoc
go run main.go
.PHONY: generate-postgresql-defaults
generate-postgresql-defaults: clone-crds ## Generates VSHNPostgreSQL parameter reference table from CRD YAML
python3 generator/generate-defaults.py \
.work/crds/crds/vshn.appcat.vshn.io_vshnpostgresqls.yaml \
docs/modules/ROOT/pages/references/vshnpostgresql-params.adoc