-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (48 loc) · 2.44 KB
/
Makefile
File metadata and controls
62 lines (48 loc) · 2.44 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
# Copyright 2020 Google LLC
# Modifications Copyright (C) 2025 OpenInfra Foundation Europe.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SHELL=/bin/bash
export TAG ?= latest
export DEFAULT_CR ?= ghcr.io/kptdev/krm-functions-catalog
export DEFAULT_CONTRIB_CR ?= ghcr.io/kptdev/krm-functions-catalog/krm-fn-contrib
.DEFAULT_GOAL := help
.PHONY: help
help: ## Print this help
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: test unit-test e2e-test build push
unit-test: ## Run unit tests for Go functions
cd functions/go && $(MAKE) test
cd contrib/functions/go && $(MAKE) test
e2e-test: ## Run all e2e tests
cd tests/e2etest && go test -v -run TestE2E ./...
test: unit-test e2e-test ## Run all unit tests and e2e tests
# find all subdirectories with a go.mod file in them
GO_MOD_DIRS = $(shell find . -name 'go.mod' -not -path './documentation/*' -exec sh -c 'echo "$$(dirname "{}")"' \; )
# NOTE: the above line is complicated for Mac and busybox compatibilty reasons.
# It is meant to be equivalent with this: find . -name 'go.mod' -printf "'%h' "
.PHONY: tidy
tidy:
@for f in $(GO_MOD_DIRS); do (cd $$f; echo "Tidying $$f"; go mod tidy) || exit 1; done
build: ## Build all function images.
cd functions/go && $(MAKE) build
cd contrib/functions/go && $(MAKE) build
push-curated: ## Push images to registry. WARN: This operation should only be done in CI environment.
cd functions/go && $(MAKE) push
push-contrib: ## Push images to registry. WARN: This operation should only be done in CI environment.
cd contrib/functions/go && $(MAKE) push
validate-metadata: ## Validate all metadata.yaml files against the schema
cd scripts/generate_docs && go run . validate
generate-docs: ## Generate/sync Hugo doc pages from function source
cd scripts/generate_docs && go run . generate $(FN)
serve-docs: ## Preview the documentation site locally
cd documentation && $(MAKE) serve