-
Notifications
You must be signed in to change notification settings - Fork 184
/
Makefile
188 lines (151 loc) · 4.29 KB
/
Makefile
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# Linters
.PHONY: lint
lint: chart-lint docs-lint tests-lint
.PHONY: chart-lint
chart-lint: helm-lint yaml-lint shellcheck
.PHONY: docs-lint
docs-lint: markdown-lint markdown-links-lint check-configuration-keys
.PHONY: tests-lint
tests-lint: template-tests-lint integration-tests-lint
.PHONY: markdown-lint
markdown-lint:
prettier --check "**/*.md"
markdownlint --config .markdownlint.jsonc \
docs \
CHANGELOG.md
.PHONY: helm-lint
helm-lint: helm-version
# TODO: we should add back the --strict flag but because we have made the PodDisruptionBudget
# API version dependent on cluster capabilities and because helm lint does not accept
# an --api-versions flag like helm template does we cannot make this configurable.
#
# Perhaps we could at some point run this against a cluster with particular k8s version?
#
# https://github.com/SumoLogic/sumologic-kubernetes-collection/pull/1943
helm lint \
--set sumologic.accessId=X \
--set sumologic.accessKey=X \
deploy/helm/sumologic/
helm lint --with-subcharts \
--set sumologic.accessId=X \
--set sumologic.accessKey=X \
deploy/helm/sumologic/ || true
.PHONY: yaml-lint
yaml-lint:
prettier --check "**/*.yaml" "**/*.yml"
.PHONY: shellcheck
shellcheck:
./ci/shellcheck.sh
.PHONY: markdown-links-lint
markdown-links-lint:
./ci/markdown_links_lint.sh
.PHONY: check-configuration-keys
check-configuration-keys:
python -m unittest ./ci/check_configuration_keys_test.py
./ci/check_configuration_keys.py --values deploy/helm/sumologic/values.yaml --readme deploy/helm/sumologic/README.md
.PHONY: check-dependencies
check-dependencies:
@python ./ci/check_dependencies/main.py --quiet
.PHONY: template-tests-lint
template-tests-lint:
make -C ./tests/helm golint
.PHONY: integration-tests-lint
integration-tests-lint:
make -C ./tests/integration golint
# Formatters
.PHONY: format
format: markdown-format yaml-format
.PHONY: markdown-format
markdown-format:
prettier -w "**/*.md"
.PHONY: yaml-format
yaml-format:
prettier -w "**/*.yaml" "**/*.yml"
# Tests
.PHONY: test
test: test-templates
## Template tests
.PHONY: test-templates
test-templates:
make helm-dependency-update
make -C ./tests/helm test
### Regenerate golden files for template tests
### Be sure the output is what you expect before committing!
.PHONY: regenerate-goldenfiles
regenerate-goldenfiles:
make -C ./tests/helm regenerate-goldenfiles
make yaml-format
## Integration tests
.PHONY: test-integration
make test-integration:
make -C ./tests/integration test
# Changelog management
## We use Towncrier (https://towncrier.readthedocs.io) for changelog management
## Usage: make add-changelog-entry
.PHONY: add-changelog-entry
add-changelog-entry:
./ci/add-changelog-entry.sh
## Consume the files in .changelog and update CHANGELOG.md
## We also format it afterwards to make sure it's consistent with our style
## Usage: make update-changelog VERSION=x.x.x
.PHONY: update-changelog
update-changelog:
ifndef VERSION
$(error Usage: make update-changelog VERSION=x.x.x)
endif
towncrier build --yes --version $(VERSION)
prettier -w CHANGELOG.md
git add CHANGELOG.md
## Check if the branch relative to main adds a changelog entry
.PHONY: check-changelog
check-changelog:
towncrier check
## Update OpenTelemetry Collector version
## Usage: make update-otc OTC_CURRENT_VERSION=0.73.0-sumo-1 OTC_NEW_VERSION=0.74.0-sumo-0
.PHONY: update-otc
update-otc:
./ci/update-otc.sh ${OTC_CURRENT_VERSION} ${OTC_NEW_VERSION}
# Various utilities
.PHONY: push-helm-chart
push-helm-chart:
./ci/push-helm-chart.sh
.PHONY: helm-version
helm-version:
helm version
.PHONY: helm-dependency-update
helm-dependency-update: helm-version
helm dependency update deploy/helm/sumologic
.PHONY: markdown-link-check
markdown-link-check:
./ci/markdown_link_check.sh
.PHONE: tool-versions
tool-versions:
kubectl version --client=true 2>/dev/null
helm version
jq --version
yq --version
markdown-link-check --version
markdownlint --version
prettier --version
python -V
towncrier --version
shellcheck --version
golangci-lint version
go version
kind version
# Vagrant commands
.PHONY: vup
vup:
vagrant up
.PHONY: vssh
vssh:
vagrant ssh -c 'cd /sumologic; exec "$$SHELL"'
.PHONY: vhalt
vhalt:
vagrant halt
.PHONY: vdestroy
vdestroy:
vagrant destroy -f
.PHONY: check-unused-templates
check-unused-templates:
./ci/check_unused_templates.sh