-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathTaskfile.yml
136 lines (120 loc) · 3.87 KB
/
Taskfile.yml
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
version: '3'
# if a task is referenced multiple times, only run it once
run: once
vars:
SRC_DIR:
sh: 'realpath {{default "." .SRC_DIR}}'
BUILD_ROOT:
sh: 'realpath {{default ".build" .BUILD_ROOT}}'
_MOD:
sh: dirname $(ls **/go.mod)
PKG: './...'
MOD: '{{default ._MOD .MOD}}'
includes:
build: taskfiles/build.yml
charts: taskfiles/charts.yml
ci: taskfiles/ci.yml
dev: taskfiles/dev.yml
goreleaser: taskfiles/goreleaser.yml
k8s: taskfiles/k8s.yml
tasks:
lint:
cmds:
- for:
var: MOD
cmd: cd {{.ITEM}} && golangci-lint run --timeout 28m {{.PKG}} {{.CLI_ARGS}}
- ct lint --chart-dirs ./charts --check-version-increment=false --all
lint-fix:
cmds:
- task: lint
vars:
CLI_ARGS: "--fix"
mod:tidy:
cmds:
- for:
var: MOD
cmd: go mod tidy -C {{.ITEM}}
fmt:
cmds:
- gofumpt -w ./
generate:
cmds:
- task: mod:tidy
- task: charts:generate
# update-licenses may update licenses/boilerplate.go.txt which is used
# for _some_ of k8s:generate. For simplicity, we just run update-licenses
# twice.
- task: dev:update-licenses
- task: k8s:generate
- task: dev:update-licenses
- task: generate:third-party-licenses-list
- task: generate:changelog
- nix fmt # Ensure flake.nix has been formatted.
generate:third-party-licenses-list:
dir: operator
generates:
- licenses/third_party.md
sources:
- ./operator/go.mod
- ./operator/go.sum
cmds:
# Our own packages should not be reported as third party license
# The example.com/example depedency is ignored as it's part of the
# gotohelm test suite (visit ./pkg/gotohelm/testdata/src/example/go.mod)
- |
go-licenses report ./... --template ../licenses/third_party.md.tpl \
--ignore buf.build/gen/go/redpandadata \
--ignore example.com/example \
--ignore github.com/redpanda-data/common-go \
--ignore github.com/redpanda-data/console/backend \
--ignore github.com/redpanda-data/redpanda \
--ignore github.com/redpanda-data/redpanda-operator > ../licenses/third_party.md
generate:changelog:
generates:
- charts/*/CHANGELOG.md
- operator/CHANGELOG.md
sources:
- ./.changes/**/*.md
- ./.changes/**/*.yaml
cmds:
- changie merge -u '## Unreleased' # Ensure CHANGELOG.mds are up to date.
build:
cmds:
- task: build:binaries
build:binaries:
cmds:
# TODO(chrisseto): Ditch goreleaser in favor of just go build in task
# files. We're not using it for anything other than an arch build matrix.
- task: goreleaser:build-operator-binaries
build:images:
cmds:
- task: k8s:build-operator-images
test:unit:
vars:
GO_TEST_RUNNER: '{{default "go test" .GO_TEST_RUNNER}}'
cmds:
# NB: xargs is used here in favor of taskfile's for as it allows parent
# tasks to utilizing xargs' templating (%).
- echo "{{.MOD}}" | xargs -t -I % {{.GO_TEST_RUNNER}} -C % {{.CLI_ARGS}} {{.PKG}}
test:integration:
cmds:
- task: test:unit
vars:
GO_TEST_RUNNER:
ref: .GO_TEST_RUNNER
CLI_ARGS: '{{.CLI_ARGS}} -run "^TestIntegration" -timeout 35m -tags integration'
test:acceptance:
vars:
GO_TEST_RUNNER: '{{default "go test" .GO_TEST_RUNNER}}'
CLI_ARGS: '{{.CLI_ARGS}} -tags=acceptance -run "^TestAcceptance" -timeout 20m -v'
cmds:
- task: k8s:build-operator-images
- kind delete cluster --name acceptance || true
- kind create cluster --name acceptance
- defer: kind delete cluster --name acceptance
- kind load --name acceptance docker-image localhost/redpanda-operator:dev localhost/configurator:dev
- task: test:unit
vars:
GO_TEST_RUNNER:
ref: .GO_TEST_RUNNER
CLI_ARGS: '{{.CLI_ARGS}} -run "^TestAcceptance" -timeout 35m -tags acceptance'