-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtaskfile.yml
More file actions
151 lines (139 loc) · 4.03 KB
/
taskfile.yml
File metadata and controls
151 lines (139 loc) · 4.03 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
144
145
146
147
148
149
150
151
#https://taskfile.dev/
version: "3"
dotenv:
- .env
includes:
vars:
taskfile: taskfile/.vars.yml
flatten: true
tools:
taskfile: taskfile/.tools.yml
flatten: true
k0s:
taskfile: taskfile/k0s.yml
flatten: true
kind:
taskfile: taskfile/kind.yml
flatten: true
kubectl:
taskfile: taskfile/kubectl.yml
flatten: true
git:
taskfile: taskfile/git.yml
flatten: true
generate:
taskfile: taskfile/generate.yml
flatten: true
go-tools:
taskfile: taskfile/go-tools.yml
flatten: true
controller-gen:
taskfile: taskfile/controller-gen.yml
flatten: true
conformance:
taskfile: taskfile/conformance.yml
flatten: true
vars:
tasks:
ci:
desc: "do almost all the checks"
cmds:
- task: check-commit
- task: tidy
- task: format
- task: generate
- task: controller-gen
- task: lint
- task: test
test:
desc: "run Go tests"
deps:
- task: check-go-tool
vars:
TOOL: GOTESTSUM
vars:
TOOL: envtest
PKG: '{{default "./..." .PKG}}'
FORMAT: '{{default "testdox" .FORMAT}}'
POD_IP: "1.2.3.4"
POD_NAME: "hug-7469984948-qgnfw"
POD_NAMESPACE: "hug"
HAPROXY_BIN: '{{or (env "HAPROXY_BIN") "/usr/local/sbin/haproxy"}}'
cmds:
- |
KUBEBUILDER_ASSETS=/{{.TMP}}/{{.TOOL}} \
ENVTEST_VERSION={{.ENVTEST_VERSION}} \
POD_IP={{.POD_IP}} \
POD_NAME={{.POD_NAME}} \
POD_NAMESPACE={{.POD_NAMESPACE}} \
HAPROXY_BIN={{.HAPROXY_BIN}} \
POD_IP=$POD_IP POD_NAME=$POD_NAME POD_NAMESPACE=$POD_NAMESPACE ENVTEST_VERSION=$ENVTEST_VERSION KUBEBUILDER_ASSETS=$KUBEBUILDER_ASSETS HAPROXY_BIN=$HAPROXY_BIN \
/{{.TMP}}/gotestsum/{{.GOTESTSUM_VERSION}}/gotestsum \
--format-icons=hivis \
--format={{.FORMAT}} \
--format-hide-empty-pkg \
-- -count=1 \
-tags="{{.TEST_TAGS}}" \
-v \
{{.PKG}}
tidy:
desc: "run Go mod tidy"
cmds:
- go mod tidy
lint:
desc: "run Go linters"
deps:
- task: check-go-tools
vars:
TOOLS: [BETTERALIGN, REVIVE, STATICCHECK]
cmds:
- /{{.TMP}}/revive/{{.REVIVE_VERSION}}/revive -config revive.toml -formatter friendly -set_exit_status ./...
- /{{.TMP}}/staticcheck/{{.STATICCHECK_VERSION}}/staticcheck ./...
- /{{.TMP}}/betteralign/{{.BETTERALIGN_VERSION}}/betteralign ./...
format:
desc: "formats the code"
deps:
- task: check-go-tools
vars:
TOOLS: [BETTERALIGN, GOFUMPT]
cmds:
- go fix ./...
- /{{.TMP}}/betteralign/{{.BETTERALIGN_VERSION}}/betteralign -apply ./... || true
- /{{.TMP}}/gofumpt/{{.GOFUMPT_VERSION}}/gofumpt -l -w .
- go run cmd/crd-version-check/main.go
licenses:
dir: cmd/controller
desc: "check licenses"
deps:
- task: check-go-tool
vars:
TOOL: GO_LICENSES
cmds:
- |
PROJECT="$(go list -m)"
ALLOWED_LICENSES="$(<../../.allowed_license_types)"
/{{.TMP}}/go-licenses/{{.GO_LICENSES_VERSION}}/go-licenses report --ignore "$PROJECT" --ignore "github.com/modern-go/reflect2" --ignore "golang.org/x/sys" --ignore "golang.org/x/sys/unix" .
/{{.TMP}}/go-licenses/{{.GO_LICENSES_VERSION}}/go-licenses check --allowed_licenses="$ALLOWED_LICENSES" --ignore "$PROJECT" --ignore "github.com/modern-go/reflect2" --ignore "github.com/modern-go/reflect2" --ignore "golang.org/x/sys/unix" .
check-commit:
deps:
- task: check-go-tool
vars:
TOOL: CHECK_COMMIT
cmds:
- /{{.TMP}}/check-commit/{{.CHECK_COMMIT_VERSION}}/check-commit
govulncheck:
deps:
- task: check-go-tool
vars:
TOOL: GOVULNCHECK
cmds:
- /{{.TMP}}/govulncheck/{{.GOVULNCHECK_VERSION}}/govulncheck -show verbose ./...
legal:
desc: "check legal"
cmds:
- task: govulncheck
- task: licenses
controller-gen:
cmds:
- task: controller-gen-deep-copy
- task: controller-gen-manifest