Skip to content

Commit 96e5382

Browse files
KPA experimental install
1 parent 44eabd5 commit 96e5382

File tree

30 files changed

+399
-127
lines changed

30 files changed

+399
-127
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,18 @@ yamllint:
131131
docker run --rm $$(tty -s && echo "-it" || echo) -v $(PWD):/data cytopia/yamllint:latest $$files -d "{extends: relaxed, rules: {line-length: {max: 120}}}" --no-warnings
132132

133133
.PHONY: golangci-lint
134-
golangci-lint:
134+
golangci-lint: $(GOLANGCI_LINT)
135+
136+
$(GOLANGCI_LINT): $(LOCALBIN)
135137
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
138+
@if [ -f .custom-gcl.yml ]; then \
139+
echo "Installing custom golangci-lint plugins..."; \
140+
$(LOCALBIN)/golangci-lint custom --config .custom-gcl.yml || { \
141+
echo "golangci-lint custom failed. Cleaning up..."; \
142+
rm -f $(LOCALBIN)/golangci-lint; \
143+
exit 1; \
144+
}; \
145+
fi
136146

137147
.PHONY: apidiff
138148
apidiff: go-apidiff ## Run the go-apidiff to verify any API differences compared with origin/master
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: v2.0.0
2+
name: golangci-custom-linters
3+
destination: ./bin
4+
5+
plugins:
6+
- module: sigs.k8s.io/kube-api-linter
7+
version: latest

docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ jobs:
1717
with:
1818
go-version-file: go.mod
1919

20+
- name: Check linter configuration
21+
run: make lint-config
22+
2023
- name: Run linter
2124
uses: golangci/golangci-lint-action@v8
2225
with:
2326
version: v2.5.0
27+
28+
- name: Run lint target
29+
run: make lint

docs/book/src/cronjob-tutorial/testdata/project/.golangci.yml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,37 @@ linters:
2121
- unconvert
2222
- unparam
2323
- unused
24-
settings:
25-
revive:
26-
rules:
27-
- name: comment-spacings
28-
- name: import-shadowing
29-
exclusions:
30-
generated: lax
24+
- kubeapilinter
25+
linters-settings:
26+
revive:
3127
rules:
32-
- linters:
33-
- lll
34-
path: api/*
35-
- linters:
36-
- dupl
37-
- lll
38-
path: internal/*
39-
paths:
40-
- third_party$
41-
- builtin$
42-
- examples$
28+
- name: comment-spacings
29+
- name: import-shadowing
30+
custom:
31+
- name: kubeapilinter
32+
path: ./bin/golangci-custom-linters
33+
description: "Kube API Linter plugin"
34+
original-url: "sigs.k8s.io/kube-api-linter"
35+
settings:
36+
linters: {}
37+
lintersConfig: {}
38+
exclusions:
39+
generated: lax
40+
rules:
41+
- linters:
42+
- lll
43+
path: api/*
44+
- linters:
45+
- dupl
46+
- lll
47+
path: internal/*
48+
- path-except: "^api/"
49+
linters:
50+
- kubeapilinter
51+
paths:
52+
- third_party$
53+
- builtin$
54+
- examples$
4355
formatters:
4456
enable:
4557
- gofmt

docs/book/src/cronjob-tutorial/testdata/project/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ $(ENVTEST): $(LOCALBIN)
232232
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
233233
$(GOLANGCI_LINT): $(LOCALBIN)
234234
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
235+
@echo "Running golangci-lint custom..."
236+
@$(LOCALBIN)/golangci-lint custom --config .custom-gcl.yml || { \
237+
echo "golangci-lint failed. Cleaning up..."; \
238+
rm -f $(LOCALBIN)/golangci-lint; \
239+
exit 1; \
240+
}
235241

236242
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
237243
# $1 - target path with name of binary
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: v2.0.0
2+
name: golangci-custom-linters
3+
destination: ./bin
4+
5+
plugins:
6+
- module: sigs.k8s.io/kube-api-linter
7+
version: latest

docs/book/src/getting-started/testdata/project/.github/workflows/lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ jobs:
1717
with:
1818
go-version-file: go.mod
1919

20+
- name: Check linter configuration
21+
run: make lint-config
22+
2023
- name: Run linter
2124
uses: golangci/golangci-lint-action@v8
2225
with:
2326
version: v2.5.0
27+
28+
- name: Run lint target
29+
run: make lint

docs/book/src/getting-started/testdata/project/.golangci.yml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,37 @@ linters:
2121
- unconvert
2222
- unparam
2323
- unused
24-
settings:
25-
revive:
26-
rules:
27-
- name: comment-spacings
28-
- name: import-shadowing
29-
exclusions:
30-
generated: lax
24+
- kubeapilinter
25+
linters-settings:
26+
revive:
3127
rules:
32-
- linters:
33-
- lll
34-
path: api/*
35-
- linters:
36-
- dupl
37-
- lll
38-
path: internal/*
39-
paths:
40-
- third_party$
41-
- builtin$
42-
- examples$
28+
- name: comment-spacings
29+
- name: import-shadowing
30+
custom:
31+
- name: kubeapilinter
32+
path: ./bin/golangci-custom-linters
33+
description: "Kube API Linter plugin"
34+
original-url: "sigs.k8s.io/kube-api-linter"
35+
settings:
36+
linters: {}
37+
lintersConfig: {}
38+
exclusions:
39+
generated: lax
40+
rules:
41+
- linters:
42+
- lll
43+
path: api/*
44+
- linters:
45+
- dupl
46+
- lll
47+
path: internal/*
48+
- path-except: "^api/"
49+
linters:
50+
- kubeapilinter
51+
paths:
52+
- third_party$
53+
- builtin$
54+
- examples$
4355
formatters:
4456
enable:
4557
- gofmt

docs/book/src/getting-started/testdata/project/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ $(ENVTEST): $(LOCALBIN)
228228
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
229229
$(GOLANGCI_LINT): $(LOCALBIN)
230230
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
231+
@echo "Running golangci-lint custom..."
232+
@$(LOCALBIN)/golangci-lint custom --config .custom-gcl.yml || { \
233+
echo "golangci-lint failed. Cleaning up..."; \
234+
rm -f $(LOCALBIN)/golangci-lint; \
235+
exit 1; \
236+
}
231237

232238
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
233239
# $1 - target path with name of binary
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: v2.0.0
2+
name: golangci-custom-linters
3+
destination: ./bin
4+
5+
plugins:
6+
- module: sigs.k8s.io/kube-api-linter
7+
version: latest

0 commit comments

Comments
 (0)