Skip to content

Commit 3f9e124

Browse files
authored
Merge pull request #1079 from camilamacedo86/fix-vendor
feat(makefile improvements) + feat(upgrade kind dep/module)
2 parents b43d9e3 + 9e767ee commit 3f9e124

File tree

2 files changed

+43
-9
lines changed

2 files changed

+43
-9
lines changed

Makefile

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,63 @@
1717
#
1818
# Makefile with some common workflow for dev, build and test
1919
#
20+
export GOPROXY?=https://proxy.golang.org/
21+
CONTROLLER_GEN_BIN_PATH := $(shell which controller-gen)
2022

21-
all: build test
23+
##@ General
2224

23-
.PHONY: build test
25+
# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
26+
# The awk commands is responsable to read the entire set of makefiles included in this invocation, looking for lines of the file as xyz: ## something, and then pretty-format the target and help. Then, if there's a line with ##@ something, that gets pretty-printed as a category.
27+
# More info over the usage of ANSI control characters for terminal formatting: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
28+
# More info over awk command: http://linuxcommand.org/lc3_adv_awk.php
29+
.PHONY: help
30+
help: ## Display this help
31+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
2432

25-
build:
33+
##@ Build
34+
35+
.PHONY: build
36+
build: ## Build the project locally
2637
go build -o bin/kubebuilder ./cmd
2738

28-
install: build
39+
.PHONY: install
40+
install: ## Build and install the binary with the current source code. Use it to test your changes locally.
41+
make build
2942
cp ./bin/kubebuilder $(shell go env GOPATH)/bin/kubebuilder
3043

31-
generate:
44+
##@ Development
45+
46+
.PHONY: generate
47+
generate: ## Update/generate all mock data. You should run this commands to update the mock data after your changes.
48+
make generate-vendor
49+
make generate-setup
50+
make generate-testdata
51+
52+
.PHONY: generate-testdata
53+
generate-testdata: ## Update/generate the testdata in $GOPATH/src/sigs.k8s.io/kubebuilder
3254
GO111MODULE=on ./generated_golden.sh
3355

56+
.PHONY: generate-vendor
57+
generate-vendor: ## Update/generate the vendor by using the path $GOPATH/src/sigs.k8s.io/kubebuilder-test
58+
GO111MODULE=off ./generate_vendor.sh
59+
60+
.PHONY: generate-setup
61+
generate-setup: ## Current workarround to generate the testdata with the correct controller-gen version
62+
- rm -rf $(CONTROLLER_GEN_BIN_PATH)
63+
- GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/[email protected]
64+
65+
##@ Tests
66+
3467
.PHONY: test
35-
test:
68+
test: ## Run the go tests ($ go test -v ./cmd/... ./pkg/...)
3669
go test -v ./cmd/... ./pkg/...
3770

3871
.PHONY: test-project-generation
39-
test-project-generation:
72+
test-project-generation: ## Run the unit tests (used in the CI)
73+
- go get sigs.k8s.io/[email protected]
4074
./test.sh
4175

4276
.PHONY: test-e2e
43-
test-e2e:
77+
test-e2e: ## Run the integration tests (used in the CI)
4478
./test_e2e_v1.sh
4579
./test_e2e_v2.sh

scripts/install_and_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
export GO111MODULE=on
1818

19-
go get sigs.k8s.io/kind@v0.4.0
19+
go get sigs.k8s.io/kind@v0.5.1
2020
go get sigs.k8s.io/kustomize/v3/cmd/[email protected]
2121

2222
# You can use --image flag to specify the cluster version you want, e.g --image=kindest/node:v1.13.6, the supported version are listed at https://hub.docker.com/r/kindest/node/tags

0 commit comments

Comments
 (0)