Skip to content

Commit d1cbcc1

Browse files
committed
#754 Extract auto discovery doc generation as function
Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
1 parent afb1faa commit d1cbcc1

2 files changed

Lines changed: 23 additions & 12 deletions

File tree

Makefile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,9 @@ scanner-docs: ## Generate documentation for scanners.
7777
operator-docs: ## Generate documentation for the operator.
7878
$(BIN_DIR)/generate-docs.sh --operator $(OPERATOR_DIR)/Chart.yaml $(HELM_DOCS_DIR)
7979

80-
# FIXME: #754 Remove .ONESHELL which is unsupported on some systems
8180
.PHONY: auto-discovery-docs
82-
.ONESHELL:
8381
auto-discovery-docs: ## Generate documentation for the auto-discovery.
84-
cd auto-discovery/kubernetes
85-
if [ -d "docs" ]; then
86-
echo "Docs Folder found at: auto-discovery/kubernetes/docs"
87-
helm-docs --template-files=$(HELM_DOCS_DIR)/templates.gotmpl --template-files=.helm-docs.gotmpl --template-files=$(HELM_DOCS_DIR)/README.DockerHub-Core.md.gotmpl --output-file=docs/README.DockerHub-Core.md
88-
helm-docs --template-files=$(HELM_DOCS_DIR)/templates.gotmpl --template-files=.helm-docs.gotmpl --template-files=$(HELM_DOCS_DIR)/README.ArtifactHub.md.gotmpl --output-file=docs/README.ArtifactHub.md
89-
else
90-
echo "Ignoring Docs creation process for Chart $$dir, because no `docs` folder found at: auto-discovery/kubernetes/docs"
91-
fi
82+
$(BIN_DIR)/generate-docs.sh --operator $(AUTO_DISCOVERY_DIR)/kubernetes/Chart.yaml $(HELM_DOCS_DIR)
9283

9384
.PHONY: demo-target-docs
9485
demo-target-docs: ## Generate documentation for demo targets.

bin/generate-docs.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,28 @@ function generate_operator_docs() {
185185
}
186186

187187
function generate_auto_discovery_docs() {
188-
error "Not implemented yet!"
189-
exit 1
188+
log "Generating auto discovery docs for ${CHART_FILE}..."
189+
190+
local auto_discovery_dir docs_dir
191+
192+
auto_discovery_dir="$(dirname "${CHART_FILE}")"
193+
docs_dir="${auto_discovery_dir}/docs"
194+
195+
if [ ! -d "${docs_dir}" ]; then
196+
log "Ignoring docs creation process for '${CHART_FILE}' because docs folder found at: '${docs_dir}'!"
197+
exit 0
198+
fi
199+
200+
generate_docs "${auto_discovery_dir}" \
201+
"docs/README.DockerHub-Core.md" \
202+
"${HELM_DOCS_DIR}/templates.gotmpl" \
203+
"${auto_discovery_dir}.helm-docs.gotmpl" \
204+
"${HELM_DOCS_DIR}/README.DockerHub-Core.md.gotmpl"
205+
generate_docs "${auto_discovery_dir}" \
206+
"docs/README.ArtifactHub.md" \
207+
"${HELM_DOCS_DIR}/templates.gotmpl" \
208+
"${auto_discovery_dir}.helm-docs.gotmpl" \
209+
"${HELM_DOCS_DIR}/README.ArtifactHub.md.gotmpl"
190210
}
191211

192212
function main() {

0 commit comments

Comments
 (0)