|
| 1 | +########################### |
| 2 | +# Configuration Variables # |
| 3 | +########################### |
| 4 | +# Setting SHELL to bash allows bash commands to be executed by recipes. |
| 5 | +# Options are set to exit when a recipe line exits non-zero or a piped command fails. |
| 6 | +SHELL := /usr/bin/env bash -o pipefail |
| 7 | +.SHELLFLAGS := -ec |
| 8 | +export ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) |
| 9 | + |
| 10 | +GOLANG_VERSION := $(shell sed -En 's/^go (.*)$$/\1/p' "go.mod") |
| 11 | +# Image URL to use all building/pushing image targets |
| 12 | +ifeq ($(origin IMAGE_REPO), undefined) |
| 13 | +IMAGE_REPO := quay.io/operator-framework/operator-controller |
| 14 | +endif |
| 15 | +export IMAGE_REPO |
| 16 | + |
| 17 | +ifeq ($(origin IMAGE_TAG), undefined) |
| 18 | +IMAGE_TAG := devel |
| 19 | +endif |
| 20 | +export IMAGE_TAG |
| 21 | + |
| 22 | +IMG := $(IMAGE_REPO):$(IMAGE_TAG) |
| 23 | + |
| 24 | +# Define dependency versions (use go.mod if we also use Go code from dependency) |
| 25 | +export CERT_MGR_VERSION := v1.15.3 |
| 26 | +export CATALOGD_VERSION := $(shell go list -mod=mod -m -f "{{.Version}}" github.com/operator-framework/catalogd) |
| 27 | +export WAIT_TIMEOUT := 60s |
| 28 | + |
| 29 | +# Install default ClusterCatalogs |
| 30 | +export INSTALL_DEFAULT_CATALOGS := true |
| 31 | + |
| 32 | +# By default setup-envtest binary will write to $XDG_DATA_HOME, or $HOME/.local/share if that is not defined. |
| 33 | +# If $HOME is not set, we need to specify a binary directory to prevent an error in setup-envtest. |
| 34 | +# Useful for some CI/CD environments that set neither $XDG_DATA_HOME nor $HOME. |
| 35 | +SETUP_ENVTEST_BIN_DIR_OVERRIDE += --bin-dir $(ROOT_DIR)/bin/envtest-binaries |
| 36 | +ifeq ($(shell [[ $$HOME == "" || $$HOME == "/" ]] && [[ $$XDG_DATA_HOME == "" ]] && echo true ), true) |
| 37 | + SETUP_ENVTEST_BIN_DIR_OVERRIDE += --bin-dir /tmp/envtest-binaries |
| 38 | +endif |
| 39 | + |
| 40 | +# bingo manages consistent tooling versions for things like kind, kustomize, etc. |
| 41 | +include .bingo/Variables.mk |
| 42 | + |
| 43 | +ifeq ($(origin KIND_CLUSTER_NAME), undefined) |
| 44 | +KIND_CLUSTER_NAME := operator-controller |
| 45 | +endif |
| 46 | + |
| 47 | +# Not guaranteed to have patch releases available and node image tags are full versions (i.e v1.28.0 - no v1.28, v1.29, etc.) |
| 48 | +# The KIND_NODE_VERSION is set by getting the version of the k8s.io/client-go dependency from the go.mod |
| 49 | +# and sets major version to "1" and the patch version to "0". For example, a client-go version of v0.28.5 |
| 50 | +# will map to a KIND_NODE_VERSION of 1.28.0 |
| 51 | +KIND_NODE_VERSION := $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.0/') |
| 52 | +KIND_CLUSTER_IMAGE := kindest/node:v$(KIND_NODE_VERSION) |
| 53 | + |
| 54 | +ifneq (, $(shell command -v docker 2>/dev/null)) |
| 55 | +CONTAINER_RUNTIME := docker |
| 56 | +else ifneq (, $(shell command -v podman 2>/dev/null)) |
| 57 | +CONTAINER_RUNTIME := podman |
| 58 | +else |
| 59 | +$(warning Could not find docker or podman in path! This may result in targets requiring a container runtime failing!) |
| 60 | +endif |
| 61 | + |
| 62 | +KUSTOMIZE_BUILD_DIR := config/overlays/cert-manager |
| 63 | + |
| 64 | +# Disable -j flag for make |
| 65 | +.NOTPARALLEL: |
| 66 | + |
| 67 | +.DEFAULT_GOAL := build |
| 68 | + |
| 69 | +#SECTION General |
| 70 | + |
| 71 | +# The help target prints out all targets with their descriptions organized |
| 72 | +# beneath their categories. The categories are represented by '#SECTION' and the |
| 73 | +# target descriptions by '#HELP' or '#EXHELP'. The awk commands is responsible for reading the |
| 74 | +# entire set of makefiles included in this invocation, looking for lines of the |
| 75 | +# file as xyz: #HELP something, and then pretty-format the target and help. Then, |
| 76 | +# if there's a line with #SECTION something, that gets pretty-printed as a category. |
| 77 | +# More info on the usage of ANSI control characters for terminal formatting: |
| 78 | +# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters |
| 79 | +# More info on the awk command: |
| 80 | +# http://linuxcommand.org/lc3_adv_awk.php |
| 81 | +# The extended-help target uses '#EXHELP' as the delineator. |
| 82 | + |
| 83 | +.PHONY: help |
| 84 | +help: #HELP Display essential help. |
| 85 | + @awk 'BEGIN {FS = ":[^#]*#HELP"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\n"} /^[a-zA-Z_0-9-]+:.*#HELP / { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST) |
| 86 | + |
| 87 | +.PHONY: help-extended |
| 88 | +help-extended: #HELP Display extended help. |
| 89 | + @awk 'BEGIN {FS = ":.*#(EX)?HELP"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*#(EX)?HELP / { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^#SECTION / { printf "\n\033[1m%s\033[0m\n", substr($$0, 10) } ' $(MAKEFILE_LIST) |
| 90 | + |
| 91 | +#SECTION Development |
| 92 | + |
| 93 | +.PHONY: lint |
| 94 | +lint: $(GOLANGCI_LINT) #HELP Run golangci linter. |
| 95 | + $(GOLANGCI_LINT) run --build-tags $(GO_BUILD_TAGS) $(GOLANGCI_LINT_ARGS) |
| 96 | + |
| 97 | +.PHONY: tidy |
| 98 | +tidy: #HELP Update dependencies. |
| 99 | + # Force tidy to use the version already in go.mod |
| 100 | + $(Q)go mod tidy -go=$(GOLANG_VERSION) |
| 101 | + |
| 102 | +.PHONY: manifests |
| 103 | +manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects. |
| 104 | + $(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/base/crd/bases output:rbac:artifacts:config=config/base/rbac |
| 105 | + |
| 106 | +.PHONY: generate |
| 107 | +generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. |
| 108 | + $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." |
| 109 | + |
| 110 | +.PHONY: verify |
| 111 | +verify: tidy fmt vet generate manifests crd-ref-docs #HELP Verify all generated code is up-to-date. |
| 112 | + git diff --exit-code |
| 113 | + |
| 114 | +.PHONY: fix-lint |
| 115 | +fix-lint: $(GOLANGCI_LINT) #EXHELP Fix lint issues |
| 116 | + $(GOLANGCI_LINT) run --fix --build-tags $(GO_BUILD_TAGS) $(GOLANGCI_LINT_ARGS) |
| 117 | + |
| 118 | +.PHONY: fmt |
| 119 | +fmt: #EXHELP Formats code |
| 120 | + go fmt ./... |
| 121 | + |
| 122 | +.PHONY: vet |
| 123 | +vet: #EXHELP Run go vet against code. |
| 124 | + go vet -tags '$(GO_BUILD_TAGS)' ./... |
| 125 | + |
| 126 | +.PHONY: bingo-upgrade |
| 127 | +bingo-upgrade: $(BINGO) #EXHELP Upgrade tools |
| 128 | + @for pkg in $$($(BINGO) list | awk '{ print $$1 }' | tail -n +3); do \ |
| 129 | + echo "Upgrading $$pkg to latest..."; \ |
| 130 | + $(BINGO) get "$$pkg@latest"; \ |
| 131 | + done |
| 132 | + |
| 133 | +.PHONY: verify-crd-compatibility |
| 134 | +CRD_DIFF_ORIGINAL_REF := main |
| 135 | +CRD_DIFF_UPDATED_SOURCE := file://config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml |
| 136 | +CRD_DIFF_CONFIG := crd-diff-config.yaml |
| 137 | +verify-crd-compatibility: $(CRD_DIFF) manifests |
| 138 | + $(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml" ${CRD_DIFF_UPDATED_SOURCE} |
| 139 | + |
| 140 | +.PHONY: test |
| 141 | +test: manifests generate fmt vet test-unit test-e2e #HELP Run all tests. |
| 142 | + |
| 143 | +.PHONY: e2e |
| 144 | +e2e: #EXHELP Run the e2e tests. |
| 145 | + go test -count=1 -v ./test/e2e/... |
| 146 | + |
| 147 | +E2E_REGISTRY_NAME := docker-registry |
| 148 | +E2E_REGISTRY_NAMESPACE := operator-controller-e2e |
| 149 | + |
| 150 | +export REG_PKG_NAME := registry-operator |
| 151 | +export LOCAL_REGISTRY_HOST := $(E2E_REGISTRY_NAME).$(E2E_REGISTRY_NAMESPACE).svc:5000 |
| 152 | +export CLUSTER_REGISTRY_HOST := localhost:30000 |
| 153 | +export E2E_TEST_CATALOG_V1 := e2e/test-catalog:v1 |
| 154 | +export E2E_TEST_CATALOG_V2 := e2e/test-catalog:v2 |
| 155 | +export CATALOG_IMG := $(LOCAL_REGISTRY_HOST)/$(E2E_TEST_CATALOG_V1) |
| 156 | +.PHONY: test-ext-dev-e2e |
| 157 | +test-ext-dev-e2e: $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run extension create, upgrade and delete tests. |
| 158 | + test/extension-developer-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) $(E2E_REGISTRY_NAMESPACE) |
| 159 | + go test -count=1 -v ./test/extension-developer-e2e/... |
| 160 | + |
| 161 | +ENVTEST_VERSION := $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/') |
| 162 | +UNIT_TEST_DIRS := $(shell go list ./... | grep -v /test/) |
| 163 | +COVERAGE_UNIT_DIR := $(ROOT_DIR)/coverage/unit |
| 164 | + |
| 165 | +.PHONY: envtest-k8s-bins #HELP Uses setup-envtest to download and install the binaries required to run ENVTEST-test based locally at the project/bin directory. |
| 166 | +envtest-k8s-bins: $(SETUP_ENVTEST) |
| 167 | + mkdir -p $(ROOT_DIR)/bin |
| 168 | + $(SETUP_ENVTEST) use -p env $(ENVTEST_VERSION) $(SETUP_ENVTEST_BIN_DIR_OVERRIDE) |
| 169 | + |
| 170 | +.PHONY: test-unit |
| 171 | +test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests |
| 172 | + rm -rf $(COVERAGE_UNIT_DIR) && mkdir -p $(COVERAGE_UNIT_DIR) |
| 173 | + KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use -p path $(ENVTEST_VERSION) $(SETUP_ENVTEST_BIN_DIR_OVERRIDE))" \ |
| 174 | + CGO_ENABLED=1 go test \ |
| 175 | + -tags '$(GO_BUILD_TAGS)' \ |
| 176 | + -cover -coverprofile ${ROOT_DIR}/coverage/unit.out \ |
| 177 | + -count=1 -race -short \ |
| 178 | + $(UNIT_TEST_DIRS) \ |
| 179 | + -test.gocoverdir=$(COVERAGE_UNIT_DIR) |
| 180 | + |
| 181 | +.PHONY: image-registry |
| 182 | +E2E_REGISTRY_IMAGE=localhost/e2e-test-registry:devel |
| 183 | +image-registry: export GOOS=linux |
| 184 | +image-registry: export GOARCH=amd64 |
| 185 | +image-registry: ## Build the testdata catalog used for e2e tests and push it to the image registry |
| 186 | + go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o ./testdata/registry/bin/registry ./testdata/registry/registry.go |
| 187 | + go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o ./testdata/push/bin/push ./testdata/push/push.go |
| 188 | + $(CONTAINER_RUNTIME) build -f ./testdata/Dockerfile -t $(E2E_REGISTRY_IMAGE) ./testdata |
| 189 | + $(CONTAINER_RUNTIME) save $(E2E_REGISTRY_IMAGE) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME) |
| 190 | + ./testdata/build-test-registry.sh $(E2E_REGISTRY_NAMESPACE) $(E2E_REGISTRY_NAME) $(E2E_REGISTRY_IMAGE) |
| 191 | + |
| 192 | +# When running the e2e suite, you can set the ARTIFACT_PATH variable to the absolute path |
| 193 | +# of the directory for the operator-controller e2e tests to store the artifacts, which |
| 194 | +# may be helpful for debugging purposes after a test run. |
| 195 | +# |
| 196 | +# for example: ARTIFACT_PATH=/tmp/artifacts make test-e2e |
| 197 | +.PHONY: test-e2e |
| 198 | +test-e2e: KIND_CLUSTER_NAME := operator-controller-e2e |
| 199 | +test-e2e: KUSTOMIZE_BUILD_DIR := config/overlays/e2e |
| 200 | +test-e2e: GO_BUILD_FLAGS := -cover |
| 201 | +test-e2e: run image-registry e2e e2e-coverage kind-clean #HELP Run e2e test suite on local kind cluster |
| 202 | + |
| 203 | +.PHONY: extension-developer-e2e |
| 204 | +extension-developer-e2e: KUSTOMIZE_BUILD_DIR := config/overlays/cert-manager |
| 205 | +extension-developer-e2e: KIND_CLUSTER_NAME := operator-controller-ext-dev-e2e #EXHELP Run extension-developer e2e on local kind cluster |
| 206 | +extension-developer-e2e: export INSTALL_DEFAULT_CATALOGS := false #EXHELP Run extension-developer e2e on local kind cluster |
| 207 | +extension-developer-e2e: run image-registry test-ext-dev-e2e kind-clean |
| 208 | + |
| 209 | +.PHONY: run-latest-release |
| 210 | +run-latest-release: |
| 211 | + curl -L -s https://github.com/operator-framework/operator-controller/releases/latest/download/install.sh | bash -s |
| 212 | + |
| 213 | +.PHONY: pre-upgrade-setup |
| 214 | +pre-upgrade-setup: |
| 215 | + ./hack/test/pre-upgrade-setup.sh $(CATALOG_IMG) $(TEST_CLUSTER_CATALOG_NAME) $(TEST_CLUSTER_EXTENSION_NAME) |
| 216 | + |
| 217 | +.PHONY: post-upgrade-checks |
| 218 | +post-upgrade-checks: |
| 219 | + go test -count=1 -v ./test/upgrade-e2e/... |
| 220 | + |
| 221 | +.PHONY: test-upgrade-e2e |
| 222 | +test-upgrade-e2e: KIND_CLUSTER_NAME := operator-controller-upgrade-e2e |
| 223 | +test-upgrade-e2e: export TEST_CLUSTER_CATALOG_NAME := test-catalog |
| 224 | +test-upgrade-e2e: export TEST_CLUSTER_EXTENSION_NAME := test-package |
| 225 | +test-upgrade-e2e: kind-cluster run-latest-release image-registry pre-upgrade-setup docker-build kind-load kind-deploy post-upgrade-checks kind-clean #HELP Run upgrade e2e tests on a local kind cluster |
| 226 | + |
| 227 | +.PHONY: e2e-coverage |
| 228 | +e2e-coverage: |
| 229 | + COVERAGE_OUTPUT=./coverage/e2e.out ./hack/test/e2e-coverage.sh |
| 230 | + |
| 231 | +.PHONY: kind-load |
| 232 | +kind-load: $(KIND) #EXHELP Loads the currently constructed image onto the cluster. |
| 233 | + $(CONTAINER_RUNTIME) save $(IMG) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME) |
| 234 | + |
| 235 | +.PHONY: kind-deploy |
| 236 | +kind-deploy: export MANIFEST="./operator-controller.yaml" |
| 237 | +kind-deploy: manifests $(KUSTOMIZE) #EXHELP Install controller and dependencies onto the kind cluster. |
| 238 | + $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) > operator-controller.yaml |
| 239 | + envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh | bash -s |
| 240 | + |
| 241 | +.PHONY: kind-cluster |
| 242 | +kind-cluster: $(KIND) #EXHELP Standup a kind cluster. |
| 243 | + -$(KIND) delete cluster --name $(KIND_CLUSTER_NAME) |
| 244 | + $(KIND) create cluster --name $(KIND_CLUSTER_NAME) --image $(KIND_CLUSTER_IMAGE) --config ./kind-config.yaml |
| 245 | + $(KIND) export kubeconfig --name $(KIND_CLUSTER_NAME) |
| 246 | + |
| 247 | +.PHONY: kind-clean |
| 248 | +kind-clean: $(KIND) #EXHELP Delete the kind cluster. |
| 249 | + $(KIND) delete cluster --name $(KIND_CLUSTER_NAME) |
| 250 | + |
| 251 | +#SECTION Build |
| 252 | + |
| 253 | +ifeq ($(origin VERSION), undefined) |
| 254 | +VERSION := $(shell git describe --tags --always --dirty) |
| 255 | +endif |
| 256 | +export VERSION |
| 257 | + |
| 258 | +ifeq ($(origin CGO_ENABLED), undefined) |
| 259 | +CGO_ENABLED := 0 |
| 260 | +endif |
| 261 | +export CGO_ENABLED |
| 262 | + |
| 263 | +export GIT_REPO := $(shell go list -m) |
| 264 | +export VERSION_PATH := ${GIT_REPO}/internal/version |
| 265 | +export GO_BUILD_TAGS := containers_image_openpgp |
| 266 | +export GO_BUILD_ASMFLAGS := all=-trimpath=$(PWD) |
| 267 | +export GO_BUILD_GCFLAGS := all=-trimpath=$(PWD) |
| 268 | +export GO_BUILD_FLAGS := |
| 269 | +export GO_BUILD_LDFLAGS := -s -w \ |
| 270 | + -X '$(VERSION_PATH).version=$(VERSION)' \ |
| 271 | + |
| 272 | +BINARIES=manager |
| 273 | + |
| 274 | +$(BINARIES): |
| 275 | + go build $(GO_BUILD_FLAGS) -tags '$(GO_BUILD_TAGS)' -ldflags '$(GO_BUILD_LDFLAGS)' -gcflags '$(GO_BUILD_GCFLAGS)' -asmflags '$(GO_BUILD_ASMFLAGS)' -o $(BUILDBIN)/$@ ./cmd/$@ |
| 276 | + |
| 277 | +.PHONY: build-deps |
| 278 | +build-deps: manifests generate fmt vet |
| 279 | + |
| 280 | +.PHONY: build go-build-local |
| 281 | +build: build-deps go-build-local #HELP Build manager binary for current GOOS and GOARCH. Default target. |
| 282 | +go-build-local: BUILDBIN := bin |
| 283 | +go-build-local: $(BINARIES) |
| 284 | + |
| 285 | +.PHONY: build-linux go-build-linux |
| 286 | +build-linux: build-deps go-build-linux #EXHELP Build manager binary for GOOS=linux and local GOARCH. |
| 287 | +go-build-linux: BUILDBIN := bin/linux |
| 288 | +go-build-linux: export GOOS=linux |
| 289 | +go-build-linux: export GOARCH=amd64 |
| 290 | +go-build-linux: $(BINARIES) |
| 291 | + |
| 292 | +.PHONY: run |
| 293 | +run: docker-build kind-cluster kind-load kind-deploy #HELP Build the operator-controller then deploy it into a new kind cluster. |
| 294 | + |
| 295 | +.PHONY: docker-build |
| 296 | +docker-build: build-linux #EXHELP Build docker image for operator-controller with GOOS=linux and local GOARCH. |
| 297 | + $(CONTAINER_RUNTIME) build -t $(IMG) -f Dockerfile ./bin/linux |
| 298 | + |
| 299 | +#SECTION Release |
| 300 | +ifeq ($(origin ENABLE_RELEASE_PIPELINE), undefined) |
| 301 | +ENABLE_RELEASE_PIPELINE := false |
| 302 | +endif |
| 303 | +ifeq ($(origin GORELEASER_ARGS), undefined) |
| 304 | +GORELEASER_ARGS := --snapshot --clean |
| 305 | +endif |
| 306 | + |
| 307 | +export ENABLE_RELEASE_PIPELINE |
| 308 | +export GORELEASER_ARGS |
| 309 | + |
| 310 | +.PHONY: release |
| 311 | +release: $(GORELEASER) #EXHELP Runs goreleaser for the operator-controller. By default, this will run only as a snapshot and will not publish any artifacts unless it is run with different arguments. To override the arguments, run with "GORELEASER_ARGS=...". When run as a github action from a tag, this target will publish a full release. |
| 312 | + $(GORELEASER) $(GORELEASER_ARGS) |
| 313 | + |
| 314 | +.PHONY: quickstart |
| 315 | +quickstart: export MANIFEST := https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml |
| 316 | +quickstart: $(KUSTOMIZE) manifests #EXHELP Generate the installation release manifests and scripts. |
| 317 | + $(KUSTOMIZE) build $(KUSTOMIZE_BUILD_DIR) | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml |
| 318 | + envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$INSTALL_DEFAULT_CATALOGS,$$MANIFEST' < scripts/install.tpl.sh > install.sh |
| 319 | + |
| 320 | +##@ Docs |
| 321 | + |
| 322 | +.PHONY: crd-ref-docs |
| 323 | +OPERATOR_CONTROLLER_API_REFERENCE_FILENAME := operator-controller-api-reference.md |
| 324 | +CATALOGD_API_REFERENCE_FILENAME := catalogd-api-reference.md |
| 325 | +CATALOGD_TMP_DIR := $(ROOT_DIR)/.catalogd-tmp/ |
| 326 | +API_REFERENCE_DIR := $(ROOT_DIR)/docs/api-reference |
| 327 | +crd-ref-docs: $(CRD_REF_DOCS) #EXHELP Generate the API Reference Documents. |
| 328 | + rm -f $(API_REFERENCE_DIR)/$(OPERATOR_CONTROLLER_API_REFERENCE_FILENAME) |
| 329 | + $(CRD_REF_DOCS) --source-path=$(ROOT_DIR)/api \ |
| 330 | + --config=$(API_REFERENCE_DIR)/crd-ref-docs-gen-config.yaml \ |
| 331 | + --renderer=markdown --output-path=$(API_REFERENCE_DIR)/$(OPERATOR_CONTROLLER_API_REFERENCE_FILENAME); |
| 332 | + rm -rf $(CATALOGD_TMP_DIR) |
| 333 | + git clone --depth 1 --branch $(CATALOGD_VERSION) https://github.com/operator-framework/catalogd $(CATALOGD_TMP_DIR) |
| 334 | + rm -f $(API_REFERENCE_DIR)/$(CATALOGD_API_REFERENCE_FILENAME) |
| 335 | + $(CRD_REF_DOCS) --source-path=$(CATALOGD_TMP_DIR)/api \ |
| 336 | + --config=$(API_REFERENCE_DIR)/crd-ref-docs-gen-config.yaml \ |
| 337 | + --renderer=markdown --output-path=$(API_REFERENCE_DIR)/$(CATALOGD_API_REFERENCE_FILENAME) |
| 338 | + rm -rf $(CATALOGD_TMP_DIR)/ |
| 339 | + |
| 340 | +VENVDIR := $(abspath docs/.venv) |
| 341 | + |
| 342 | +.PHONY: build-docs |
| 343 | +build-docs: venv |
| 344 | + . $(VENV)/activate; \ |
| 345 | + mkdocs build |
| 346 | + |
| 347 | +.PHONY: serve-docs |
| 348 | +serve-docs: venv |
| 349 | + . $(VENV)/activate; \ |
| 350 | + mkdocs serve |
| 351 | + |
| 352 | +.PHONY: deploy-docs |
| 353 | +deploy-docs: venv |
| 354 | + . $(VENV)/activate; \ |
| 355 | + mkdocs gh-deploy --force |
| 356 | + |
| 357 | +include Makefile.venv |
0 commit comments