Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (121 loc) · 4.24 KB
/
Copy pathMakefile
File metadata and controls
143 lines (121 loc) · 4.24 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Copyright 2019,2026 The kpt Authors
#
# 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 := bash
.SHELLFLAGS := -exc
include ./make/info.mk
include ./make/testing.mk
include ./make/api.mk
include ./make/cli.mk
include ./make/checks.mk
all: fix vet fmt lint test build tidy
build: cli/build
update-deps-to-head:
go get sigs.k8s.io/cli-utils@master
go get sigs.k8s.io/kustomize/kyaml@master
.PHONY: install-mdrip
install-mdrip:
go install github.com/monopole/mdrip@v1.0.3
.PHONY: install-kind
install-kind:
go install sigs.k8s.io/kind@v0.29.0
.PHONY: install-golangci-lint
install-golangci-lint:
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v$(GOLANGCI_LINT_VERSION)
.PHONY: install-swagger
install-swagger:
go install github.com/go-swagger/go-swagger/cmd/swagger@$(SWAGGER_VERSION)
.PHONY: install-mdtogo
install-mdtogo:
cd mdtogo && go install .
schema:
SWAGGER_VERSION=$(SWAGGER_VERSION) GOBIN=$(GOBIN) scripts/generate-schema.sh
generate: install-mdtogo api/generate
rm -rf internal/docs/generated
mkdir internal/docs/generated
$(MAKE) cli/generate
go fmt ./internal/docs/generated/...
$(MAKE) schema
# This target is used to run Go tests that require docker runtime.
# Some tests, like pipeline tests, need to have docker available to run.
# KRM_FN_RUNTIME can be set to select the desired function runtime.
# If unspecified, the default function runtime will be used.
test-docker: build
PATH="$(GOBIN):$(PATH)" go test -cover ${LDFLAGS} --tags=docker ./...
# KPT_E2E_UPDATE_EXPECTED=true (if expected output to be updated)
# target to run e2e tests for "kpt fn render" command
# KRM_FN_RUNTIME can be set to select the desired function runtime.
# If unspecified, the default function runtime will be used.
test-fn-render: build
PATH="$(GOBIN):$(PATH)" go test -v ${LDFLAGS} --tags=docker --run=TestFnRender/testdata/fn-render/$(T) ./e2e/
# target to run e2e tests for "kpt fn eval" command
# KRM_FN_RUNTIME can be set to select the desired function runtime.
# If unspecified, the default function runtime will be used.
test-fn-eval: build
PATH="$(GOBIN):$(PATH)" go test -v ${LDFLAGS} --tags=docker --run=TestFnEval/testdata/fn-eval/$(T) ./e2e/
# target to run e2e tests for "kpt live apply" command
test-live-apply: build
PATH="$(GOBIN):$(PATH)" go test -v ${LDFLAGS} -timeout=20m --tags=kind -p 2 --run=TestLiveApply/testdata/live-apply/$(T) ./e2e/
release-dry-run:
@docker run \
--rm \
--privileged \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/github.com/kptdev/kpt \
-w /go/src/github.com/kptdev/kpt \
$(GORELEASER_IMAGE) \
-f "$(GORELEASER_CONFIG)" \
--skip=validate,publish
release:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/github.com/kptdev/kpt \
-w /go/src/github.com/kptdev/kpt \
$(GORELEASER_IMAGE) \
-f "$(GORELEASER_CONFIG)" release \
--skip=validate
release-ci:
@if [ ! -f ".release-env" ]; then \
echo "\033[91m.release-env is required for release\033[0m";\
exit 1;\
fi
docker run \
--rm \
--privileged \
--env-file .release-env \
-v ${HOME}/.docker/config.json:/root/.docker/config.json \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/github.com/kptdev/kpt \
-w /go/src/github.com/kptdev/kpt \
$(GORELEASER_IMAGE) \
-f "$(GORELEASER_CONFIG)" release \
--skip=validate
.PHONY: vulncheck
vulncheck: build
# Scan the source
GOFLAGS= go run golang.org/x/vuln/cmd/govulncheck@latest ./...
.PHONY: work
go.work go.work.sum work:
@if [ ! -f go.work ]; then \
go work init . api cli mdtogo; \
fi
.PHONY: clean-work
clean-work:
rm -f go.work go.work.sum