Skip to content

Commit fa39a75

Browse files
authored
Merge pull request #643 from jetstack/upgrade_klone
Upgrade klone
2 parents e8888e5 + 17c8a88 commit fa39a75

30 files changed

+189
-627
lines changed

.github/workflows/govulncheck.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
govulncheck:
1818
runs-on: ubuntu-latest
1919

20+
if: github.repository_owner == 'cert-manager'
21+
2022
steps:
2123
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2224
# Adding `fetch-depth: 0` makes sure tags are also fetched. We need

.golangci.yaml

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
1-
issues:
2-
exclude-rules:
3-
- linters:
4-
- bodyclose
5-
- dupword
6-
- errcheck
7-
- errchkjson
8-
- forbidigo
9-
- gci
10-
- gocritic
11-
- gofmt
12-
- gosec
13-
- gosimple
14-
- govet
15-
- misspell
16-
- musttag
17-
- nilerr
18-
- staticcheck
19-
- noctx
20-
- unconvert
21-
- unparam
22-
- usestdlibvars
23-
- predeclared
24-
text: ".*"
1+
version: "2"
252
linters:
26-
# Explicitly define all enabled linters
27-
disable-all: true
3+
default: none
4+
exclusions:
5+
generated: lax
6+
presets: [comments, common-false-positives, legacy, std-error-handling]
7+
rules:
8+
- linters:
9+
- bodyclose
10+
- dupword
11+
- errcheck
12+
- errchkjson
13+
- forbidigo
14+
- gocritic
15+
- gosec
16+
- govet
17+
- misspell
18+
- musttag
19+
- nilerr
20+
- noctx
21+
- predeclared
22+
- staticcheck
23+
- unconvert
24+
- unparam
25+
- usestdlibvars
26+
text: .*
27+
paths: [third_party$, builtin$, examples$]
28+
warn-unused: true
29+
settings:
30+
staticcheck:
31+
checks: ["all", "-ST1000", "-ST1001", "-ST1003", "-ST1005", "-ST1012", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-QF1001", "-QF1003", "-QF1008"]
2832
enable:
2933
- asasalint
3034
- asciicheck
3135
- bidichk
3236
- bodyclose
37+
- canonicalheader
3338
- contextcheck
3439
- copyloopvar
3540
- decorder
@@ -40,23 +45,22 @@ linters:
4045
- errchkjson
4146
- errname
4247
- exhaustive
48+
- exptostd
4349
- forbidigo
44-
- gci
4550
- ginkgolinter
4651
- gocheckcompilerdirectives
4752
- gochecksumtype
4853
- gocritic
49-
- gofmt
5054
- goheader
5155
- goprintffuncname
5256
- gosec
53-
- gosimple
5457
- gosmopolitan
5558
- govet
5659
- grouper
5760
- importas
5861
- ineffassign
5962
- interfacebloat
63+
- intrange
6064
- loggercheck
6165
- makezero
6266
- mirror
@@ -74,19 +78,23 @@ linters:
7478
- sloglint
7579
- staticcheck
7680
- tagalign
77-
- tenv
7881
- testableexamples
79-
- typecheck
8082
- unconvert
8183
- unparam
8284
- unused
8385
- usestdlibvars
86+
- usetesting
8487
- wastedassign
85-
linters-settings:
86-
gci:
87-
sections:
88-
- standard # Standard section: captures all standard packages.
89-
- default # Default section: contains all imports that could not be matched to another section type.
90-
- prefix(github.com/jetstack/preflight) # Custom section: groups all imports with the specified Prefix.
91-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
92-
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
88+
formatters:
89+
enable: [gci, gofmt]
90+
settings:
91+
gci:
92+
sections:
93+
- standard # Standard section: captures all standard packages.
94+
- default # Default section: contains all imports that could not be matched to another section type.
95+
- prefix(github.com/jetstack/preflight) # Custom section: groups all imports with the specified Prefix.
96+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
97+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
98+
exclusions:
99+
generated: lax
100+
paths: [third_party$, builtin$, examples$]

api/cluster_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ func TestClusterSummaryUnmarshalJSON(t *testing.T) {
4343
FailureCount: 4,
4444
SuccessCount: 1,
4545
Reports: []*ReportSummary{
46-
&ReportSummary{
46+
{
4747
ID: "exampleReport1",
4848
Package: "examplePackage.ID.1",
4949
Cluster: "exampleCluster",
5050
Timestamp: Time{Time: ts},
5151
FailureCount: 2,
5252
SuccessCount: 1,
5353
},
54-
&ReportSummary{
54+
{
5555
ID: "exampleReport2",
5656
Package: "examplePackage.ID.2",
5757
Cluster: "exampleCluster",

klone.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,50 @@ targets:
1010
- folder_name: generate-verify
1111
repo_url: https://github.com/cert-manager/makefile-modules.git
1212
repo_ref: main
13-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
13+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
1414
repo_path: modules/generate-verify
1515
- folder_name: go
1616
repo_url: https://github.com/cert-manager/makefile-modules.git
1717
repo_ref: main
18-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
18+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
1919
repo_path: modules/go
2020
- folder_name: helm
2121
repo_url: https://github.com/cert-manager/makefile-modules.git
2222
repo_ref: main
23-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
23+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
2424
repo_path: modules/helm
2525
- folder_name: help
2626
repo_url: https://github.com/cert-manager/makefile-modules.git
2727
repo_ref: main
28-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
28+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
2929
repo_path: modules/help
3030
- folder_name: kind
3131
repo_url: https://github.com/cert-manager/makefile-modules.git
3232
repo_ref: main
33-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
33+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
3434
repo_path: modules/kind
3535
- folder_name: klone
3636
repo_url: https://github.com/cert-manager/makefile-modules.git
3737
repo_ref: main
38-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
38+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
3939
repo_path: modules/klone
4040
- folder_name: oci-build
4141
repo_url: https://github.com/cert-manager/makefile-modules.git
4242
repo_ref: main
43-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
43+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
4444
repo_path: modules/oci-build
4545
- folder_name: oci-publish
4646
repo_url: https://github.com/cert-manager/makefile-modules.git
4747
repo_ref: main
48-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
48+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
4949
repo_path: modules/oci-publish
5050
- folder_name: repository-base
5151
repo_url: https://github.com/cert-manager/makefile-modules.git
5252
repo_ref: main
53-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
53+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
5454
repo_path: modules/repository-base
5555
- folder_name: tools
5656
repo_url: https://github.com/cert-manager/makefile-modules.git
5757
repo_ref: main
58-
repo_hash: 7740a28745d013a286c0573a180d0aa53ff0aa6a
58+
repo_hash: 01f8036da297256be41f6cc520cb248cb0f609fc
5959
repo_path: modules/tools

make/_shared/generate-verify/util/verify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ trap "cleanup" EXIT SIGINT
5353
# 2. rsync on macOS 15.4 and newer is actually openrsync, which has different permissions and throws errors when copying git objects
5454
#
5555
# So, we use find to list all files except _bin, and then copy each in turn
56-
find . -maxdepth 1 -not \( -path "./_bin" -prune \) | xargs -I% cp -af "${projectdir}/%" "${tmp}/"
56+
find . -maxdepth 1 -not \( -path "./_bin" \) -not \( -path "." \) | xargs -I% cp -af "${projectdir}/%" "${tmp}/"
5757

5858
pushd "${tmp}" >/dev/null
5959

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
version: "2"
12
linters:
2-
# Explicitly define all enabled linters
3-
disable-all: true
3+
default: none
4+
exclusions:
5+
generated: lax
6+
presets: [ comments, common-false-positives, legacy, std-error-handling ]
7+
paths: [ third_party$, builtin$, examples$ ]
8+
warn-unused: true
9+
settings:
10+
staticcheck:
11+
checks: [ "all", "-ST1000", "-ST1001", "-ST1003", "-ST1005", "-ST1012", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-QF1001", "-QF1003", "-QF1008" ]
412
enable:
513
- asasalint
614
- asciicheck
715
- bidichk
816
- bodyclose
17+
- canonicalheader
918
- contextcheck
1019
- copyloopvar
1120
- decorder
@@ -16,23 +25,22 @@ linters:
1625
- errchkjson
1726
- errname
1827
- exhaustive
28+
- exptostd
1929
- forbidigo
20-
- gci
2130
- ginkgolinter
2231
- gocheckcompilerdirectives
2332
- gochecksumtype
2433
- gocritic
25-
- gofmt
2634
- goheader
2735
- goprintffuncname
2836
- gosec
29-
- gosimple
3037
- gosmopolitan
3138
- govet
3239
- grouper
3340
- importas
3441
- ineffassign
3542
- interfacebloat
43+
- intrange
3644
- loggercheck
3745
- makezero
3846
- mirror
@@ -50,19 +58,23 @@ linters:
5058
- sloglint
5159
- staticcheck
5260
- tagalign
53-
- tenv
5461
- testableexamples
55-
- typecheck
5662
- unconvert
5763
- unparam
5864
- unused
5965
- usestdlibvars
66+
- usetesting
6067
- wastedassign
61-
linters-settings:
62-
gci:
63-
sections:
64-
- standard # Standard section: captures all standard packages.
65-
- default # Default section: contains all imports that could not be matched to another section type.
66-
- prefix({{REPO-NAME}}) # Custom section: groups all imports with the specified Prefix.
67-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
68-
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
68+
formatters:
69+
enable: [ gci, gofmt ]
70+
settings:
71+
gci:
72+
sections:
73+
- standard # Standard section: captures all standard packages.
74+
- default # Default section: contains all imports that could not be matched to another section type.
75+
- prefix({{REPO-NAME}}) # Custom section: groups all imports with the specified Prefix.
76+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
77+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
78+
exclusions:
79+
generated: lax
80+
paths: [ third_party$, builtin$, examples$ ]

make/_shared/go/01_mod.mk

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ ifdef golangci_lint_config
101101
.PHONY: generate-golangci-lint-config
102102
## Generate a golangci-lint configuration file
103103
## @category [shared] Generate/ Verify
104-
generate-golangci-lint-config: | $(NEEDS_YQ) $(bin_dir)/scratch
104+
generate-golangci-lint-config: | $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(bin_dir)/scratch
105+
if [ "$$($(YQ) eval 'has("version") | not' $(golangci_lint_config))" == "true" ]; then \
106+
$(GOLANGCI-LINT) migrate -c $(golangci_lint_config); \
107+
rm $(basename $(golangci_lint_config)).bck$(suffix $(golangci_lint_config)); \
108+
fi
109+
105110
cp $(golangci_lint_config) $(bin_dir)/scratch/golangci-lint.yaml.tmp
106111
$(YQ) -i 'del(.linters.enable)' $(bin_dir)/scratch/golangci-lint.yaml.tmp
107112
$(YQ) eval-all -i '. as $$item ireduce ({}; . * $$item)' $(bin_dir)/scratch/golangci-lint.yaml.tmp $(golangci_lint_override)
@@ -119,9 +124,9 @@ verify-golangci-lint: | $(NEEDS_GO) $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(bin_dir
119124
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
120125
| while read d; do \
121126
target=$$(dirname $${d}); \
122-
echo "Running '$(bin_dir)/tools/golangci-lint run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout)' in directory '$${target}'"; \
127+
echo "Running 'GOVERSION=$(VENDORED_GO_VERSION) $(bin_dir)/tools/golangci-lint run -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout)' in directory '$${target}'"; \
123128
pushd "$${target}" >/dev/null; \
124-
$(GOLANGCI-LINT) run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout) || exit; \
129+
GOVERSION=$(VENDORED_GO_VERSION) $(GOLANGCI-LINT) run -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout) || exit; \
125130
popd >/dev/null; \
126131
echo ""; \
127132
done
@@ -132,21 +137,12 @@ shared_verify_targets_dirty += verify-golangci-lint
132137
## Fix all Go modules using golangci-lint
133138
## @category [shared] Generate/ Verify
134139
fix-golangci-lint: | $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(NEEDS_GCI) $(bin_dir)/scratch
135-
$(GCI) write \
136-
--skip-generated \
137-
--skip-vendor \
138-
-s "standard" \
139-
-s "default" \
140-
-s "prefix($(repo_name))" \
141-
-s "blank" \
142-
-s "dot" .
143-
144140
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
145141
| while read d; do \
146142
target=$$(dirname $${d}); \
147-
echo "Running '$(bin_dir)/tools/golangci-lint run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --fix' in directory '$${target}'"; \
143+
echo "Running 'GOVERSION=$(VENDORED_GO_VERSION) $(bin_dir)/tools/golangci-lint fmt -c $(CURDIR)/$(golangci_lint_config)' in directory '$${target}'"; \
148144
pushd "$${target}" >/dev/null; \
149-
$(GOLANGCI-LINT) run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --fix || exit; \
145+
GOVERSION=$(VENDORED_GO_VERSION) $(GOLANGCI-LINT) fmt -c $(CURDIR)/$(golangci_lint_config) || exit; \
150146
popd >/dev/null; \
151147
echo ""; \
152148
done

make/_shared/go/base/.github/workflows/govulncheck.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
govulncheck:
1818
runs-on: ubuntu-latest
1919

20+
if: github.repository_owner == 'cert-manager'
21+
2022
steps:
2123
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2224
# Adding `fetch-depth: 0` makes sure tags are also fetched. We need

make/_shared/helm/helm.mk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,16 @@ verify-helm-lint: $(helm_chart_archive) | $(NEEDS_HELM)
178178
$(HELM) lint $(helm_chart_archive)
179179

180180
shared_verify_targets_dirty += verify-helm-lint
181+
182+
.PHONY: verify-helm-kubeconform
183+
## Verify that the Helm chart passes a strict check using kubeconform
184+
## @category [shared] Generate/ Verify
185+
verify-helm-kubeconform: $(helm_chart_archive) | $(NEEDS_KUBECONFORM)
186+
@$(HELM) template $(helm_chart_archive) $(INSTALL_OPTIONS) \
187+
| $(KUBECONFORM) \
188+
-schema-location default \
189+
-schema-location "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{.NormalizedKubernetesVersion}}/{{.ResourceKind}}.json" \
190+
-schema-location "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json" \
191+
-strict
192+
193+
shared_verify_targets_dirty += verify-helm-kubeconform

make/_shared/kind/00_kind_image_versions.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ kind_image_kube_1.31_amd64 := docker.io/kindest/node:v1.31.6@sha256:37d52dc19f59
2525
kind_image_kube_1.31_arm64 := docker.io/kindest/node:v1.31.6@sha256:4e6223faa19178922d30e7b62546c5464fdf9bc66a3df64073424a51ab44f2ab
2626
kind_image_kube_1.32_amd64 := docker.io/kindest/node:v1.32.2@sha256:a37b679ad8c1cfa7c64aca1734cc4299dc833258d6c131ed0204c8cd2bd56ff7
2727
kind_image_kube_1.32_arm64 := docker.io/kindest/node:v1.32.2@sha256:4d0e1b60f1da0d1349996a9778f8bace905189af5e05e04618eae0a155dd9f9c
28+
kind_image_kube_1.33_amd64 := docker.io/kindest/node:v1.33.0@sha256:c9ec7bf998c310c5a6c903d66c2e595fb3e2eb53fb626cd53d07a3a5499de412
29+
kind_image_kube_1.33_arm64 := docker.io/kindest/node:v1.33.0@sha256:96ae3b980f87769e0117c2a89ec74fc660b84eedb573432abd2a682af3eccc02
2830

29-
kind_image_latest_amd64 := $(kind_image_kube_1.32_amd64)
30-
kind_image_latest_arm64 := $(kind_image_kube_1.32_arm64)
31+
kind_image_latest_amd64 := $(kind_image_kube_1.33_amd64)
32+
kind_image_latest_arm64 := $(kind_image_kube_1.33_arm64)

0 commit comments

Comments
 (0)