Skip to content

Commit 444c0af

Browse files
Merge pull request #338 from cert-manager/self-upgrade-main
[CI] Merge self-upgrade-main into main
2 parents 3643203 + 3dfd579 commit 444c0af

File tree

18 files changed

+61
-56
lines changed

18 files changed

+61
-56
lines changed

.github/workflows/renovate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
go-version: ${{ steps.go-version.outputs.result }}
5151

5252
- name: Self-hosted Renovate
53-
uses: renovatebot/github-action@aec779d4f7845f8431ddf403cf9659d4702ddde0 # v43.0.18
53+
uses: renovatebot/github-action@a3c115cd6676c8a5bc72f9715f108759e570daf5 # v43.0.19
5454
with:
5555
configurationFile: .github/renovate.json5
5656
token: ${{ steps.octo-sts.outputs.token }}

.golangci.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ linters:
1111
paths: [third_party, builtin$, examples$]
1212
warn-unused: true
1313
settings:
14+
modernize:
15+
disable:
16+
# TODO(erikgb): Consider if the omitzero linter makes sense in this project
17+
- omitzero
1418
staticcheck:
1519
checks: ["all", "-ST1000", "-ST1001", "-ST1003", "-ST1005", "-ST1012", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-QF1001", "-QF1003", "-QF1008"]
1620
enable:
@@ -49,6 +53,7 @@ linters:
4953
- makezero
5054
- mirror
5155
- misspell
56+
- modernize
5257
- musttag
5358
- nakedret
5459
- nilerr
@@ -76,9 +81,10 @@ formatters:
7681
sections:
7782
- standard # Standard section: captures all standard packages.
7883
- default # Default section: contains all imports that could not be matched to another section type.
79-
- prefix(github.com/cert-manager/cmctl) # Custom section: groups all imports with the specified Prefix.
84+
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
8085
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
8186
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
87+
custom-order: true
8288
exclusions:
8389
generated: lax
8490
paths: [third_party, builtin$, examples$]

internal/versionchecker/test/getpodfromtemplate_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package versionchecker
1818

1919
import (
2020
"fmt"
21+
"maps"
2122

2223
v1 "k8s.io/api/core/v1"
2324
"k8s.io/apimachinery/pkg/api/meta"
@@ -63,9 +64,7 @@ func getPodFromTemplate(template *v1.PodTemplateSpec, parentObject runtime.Objec
6364

6465
func getPodsLabelSet(template *v1.PodTemplateSpec) labels.Set {
6566
desiredLabels := make(labels.Set)
66-
for k, v := range template.Labels {
67-
desiredLabels[k] = v
68-
}
67+
maps.Copy(desiredLabels, template.Labels)
6968
return desiredLabels
7069
}
7170

@@ -77,9 +76,7 @@ func getPodsFinalizers(template *v1.PodTemplateSpec) []string {
7776

7877
func getPodsAnnotationSet(template *v1.PodTemplateSpec) labels.Set {
7978
desiredAnnotations := make(labels.Set)
80-
for k, v := range template.Annotations {
81-
desiredAnnotations[k] = v
82-
}
79+
maps.Copy(desiredAnnotations, template.Annotations)
8380
return desiredAnnotations
8481
}
8582

internal/versionchecker/test/testdata/fetch.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ func (inv *Inventory) read(manifestsPath string) error {
203203
// Split the rest of the file into the manifests
204204
manfestsBytes = fileSplit[1]
205205

206-
manifests := bytes.Split(manfestsBytes, []byte("---\n# [CHK_VERSIONS]: "))
206+
manifests := bytes.SplitSeq(manfestsBytes, []byte("---\n# [CHK_VERSIONS]: "))
207207

208-
for _, manifest := range manifests {
208+
for manifest := range manifests {
209209
if len(manifest) == 0 {
210210
continue
211211
}
@@ -232,8 +232,8 @@ func (inv *Inventory) read(manifestsPath string) error {
232232
manifestHash := hex.EncodeToString(manifestHasher.Sum([]byte{}))
233233

234234
// Split the versions
235-
versionsSplit := strings.Split(versions, ",")
236-
for _, version := range versionsSplit {
235+
versionsSplit := strings.SplitSeq(versions, ",")
236+
for version := range versionsSplit {
237237
version = strings.TrimSpace(version)
238238
version = semver.Canonical(version)
239239

@@ -385,7 +385,7 @@ func cleanupManifests(manifests []byte, version string) ([]byte, error) {
385385

386386
decoder := yaml.NewDecoder(bytes.NewBuffer(manifests))
387387
for {
388-
var manifest map[string]interface{}
388+
var manifest map[string]any
389389

390390
err := decoder.Decode(&manifest)
391391
if errors.Is(err, io.EOF) {
@@ -407,10 +407,10 @@ func cleanupManifests(manifests []byte, version string) ([]byte, error) {
407407
case "CustomResourceDefinition":
408408
// remove all CRD schemas from yaml file
409409
switch spec := manifest["spec"].(type) {
410-
case map[string]interface{}:
411-
spec["versions"] = []interface{}{}
412-
case map[interface{}]interface{}:
413-
spec["versions"] = []interface{}{}
410+
case map[string]any:
411+
spec["versions"] = []any{}
412+
case map[any]any:
413+
spec["versions"] = []any{}
414414
}
415415

416416
// remove status from CRD

internal/versionchecker/test/versionchecker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func loadManifests(t *testing.T) []testManifest {
7070
testManifestBytes = split[1]
7171

7272
var manifests []testManifest
73-
for _, manifest := range bytes.Split(testManifestBytes, []byte("---\n# [CHK_VERSIONS]: ")) {
73+
for manifest := range bytes.SplitSeq(testManifestBytes, []byte("---\n# [CHK_VERSIONS]: ")) {
7474
if len(manifest) == 0 {
7575
continue
7676
}

klone.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,45 @@ targets:
1010
- folder_name: boilerplate
1111
repo_url: https://github.com/cert-manager/makefile-modules.git
1212
repo_ref: main
13-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
13+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
1414
repo_path: modules/boilerplate
1515
- folder_name: cert-manager
1616
repo_url: https://github.com/cert-manager/makefile-modules.git
1717
repo_ref: main
18-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
18+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
1919
repo_path: modules/cert-manager
2020
- folder_name: executable
2121
repo_url: https://github.com/cert-manager/makefile-modules.git
2222
repo_ref: main
23-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
23+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
2424
repo_path: modules/executable
2525
- folder_name: generate-verify
2626
repo_url: https://github.com/cert-manager/makefile-modules.git
2727
repo_ref: main
28-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
28+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
2929
repo_path: modules/generate-verify
3030
- folder_name: go
3131
repo_url: https://github.com/cert-manager/makefile-modules.git
3232
repo_ref: main
33-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
33+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
3434
repo_path: modules/go
3535
- folder_name: help
3636
repo_url: https://github.com/cert-manager/makefile-modules.git
3737
repo_ref: main
38-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
38+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
3939
repo_path: modules/help
4040
- folder_name: klone
4141
repo_url: https://github.com/cert-manager/makefile-modules.git
4242
repo_ref: main
43-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
43+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
4444
repo_path: modules/klone
4545
- folder_name: repository-base
4646
repo_url: https://github.com/cert-manager/makefile-modules.git
4747
repo_ref: main
48-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
48+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
4949
repo_path: modules/repository-base
5050
- folder_name: tools
5151
repo_url: https://github.com/cert-manager/makefile-modules.git
5252
repo_ref: main
53-
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
53+
repo_hash: 2121d6bf1ec6440011bc03021015af1c18ec0eba
5454
repo_path: modules/tools

make/_shared/go/.golangci.override.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ linters:
4545
- makezero
4646
- mirror
4747
- misspell
48+
- modernize
4849
- musttag
4950
- nakedret
5051
- nilerr
@@ -69,10 +70,11 @@ formatters:
6970
enable: [ gci, gofmt ]
7071
settings:
7172
gci:
73+
custom-order: true
7274
sections:
7375
- standard # Standard section: captures all standard packages.
7476
- 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.
77+
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
7678
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
7779
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
7880
exclusions:

make/_shared/go/01_mod.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ generate-golangci-lint-config: | $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(bin_dir)/s
117117
cp $(golangci_lint_config) $(bin_dir)/scratch/golangci-lint.yaml.tmp
118118
$(YQ) -i 'del(.linters.enable)' $(bin_dir)/scratch/golangci-lint.yaml.tmp
119119
$(YQ) eval-all -i '. as $$item ireduce ({}; . * $$item)' $(bin_dir)/scratch/golangci-lint.yaml.tmp $(golangci_lint_override)
120-
$(YQ) -i '(.. | select(tag == "!!str")) |= sub("{{REPO-NAME}}", "$(repo_name)")' $(bin_dir)/scratch/golangci-lint.yaml.tmp
121120
mv $(bin_dir)/scratch/golangci-lint.yaml.tmp $(golangci_lint_config)
122121

123122
shared_generate_targets += generate-golangci-lint-config
@@ -147,9 +146,9 @@ fix-golangci-lint: | $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(NEEDS_GCI) $(bin_dir)/
147146
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
148147
| while read d; do \
149148
target=$$(dirname $${d}); \
150-
echo "Running 'GOVERSION=$(VENDORED_GO_VERSION) $(bin_dir)/tools/golangci-lint fmt -c $(CURDIR)/$(golangci_lint_config)' in directory '$${target}'"; \
149+
echo "Running 'GOVERSION=$(VENDORED_GO_VERSION) $(bin_dir)/tools/golangci-lint run --fix -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout)' in directory '$${target}'"; \
151150
pushd "$${target}" >/dev/null; \
152-
GOVERSION=$(VENDORED_GO_VERSION) $(GOLANGCI-LINT) fmt -c $(CURDIR)/$(golangci_lint_config) || exit; \
151+
GOVERSION=$(VENDORED_GO_VERSION) $(GOLANGCI-LINT) run --fix -c $(CURDIR)/$(golangci_lint_config) --timeout $(golangci_lint_timeout) || exit; \
153152
popd >/dev/null; \
154153
echo ""; \
155154
done

make/_shared/repository-base/base/.github/workflows/renovate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
go-version: ${{ steps.go-version.outputs.result }}
5151

5252
- name: Self-hosted Renovate
53-
uses: renovatebot/github-action@aec779d4f7845f8431ddf403cf9659d4702ddde0 # v43.0.18
53+
uses: renovatebot/github-action@a3c115cd6676c8a5bc72f9715f108759e570daf5 # v43.0.19
5454
with:
5555
configurationFile: .github/renovate.json5
5656
token: ${{ steps.octo-sts.outputs.token }}

make/_shared/tools/00_mod.mk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ tools += yq=v4.48.1
8686
tools += ko=0.18.0
8787
# https://github.com/protocolbuffers/protobuf/releases
8888
# renovate: datasource=github-releases packageName=protocolbuffers/protobuf
89-
tools += protoc=v32.1
89+
tools += protoc=v33.0
9090
# https://github.com/aquasecurity/trivy/releases
9191
# renovate: datasource=github-releases packageName=aquasecurity/trivy
9292
tools += trivy=v0.67.2
@@ -167,7 +167,7 @@ tools += cmctl=v2.3.0
167167
tools += cmrel=v1.12.15-0.20241121151736-e3cbe5171488
168168
# https://pkg.go.dev/github.com/golangci/golangci-lint/v2/cmd/golangci-lint?tab=versions
169169
# renovate: datasource=go packageName=github.com/golangci/golangci-lint/v2
170-
tools += golangci-lint=v2.5.0
170+
tools += golangci-lint=v2.6.0
171171
# https://pkg.go.dev/golang.org/x/vuln?tab=versions
172172
# renovate: datasource=go packageName=golang.org/x/vuln
173173
tools += govulncheck=v1.1.4
@@ -499,7 +499,7 @@ $(DOWNLOAD_DIR)/tools/vault@$(VAULT_VERSION)_$(HOST_OS)_$(HOST_ARCH): | $(DOWNLO
499499
@source $(lock_script) $@; \
500500
$(CURL) https://releases.hashicorp.com/vault/$(VAULT_VERSION:v%=%)/vault_$(VAULT_VERSION:v%=%)_$(HOST_OS)_$(HOST_ARCH).zip -o $(outfile).zip; \
501501
$(checkhash_script) $(outfile).zip $(vault_$(HOST_OS)_$(HOST_ARCH)_SHA256SUM); \
502-
unzip -qq -c $(outfile).zip > $(outfile); \
502+
unzip -p $(outfile).zip vault > $(outfile); \
503503
chmod +x $(outfile); \
504504
rm -f $(outfile).zip
505505

@@ -580,10 +580,10 @@ $(DOWNLOAD_DIR)/tools/ko@$(KO_VERSION)_$(HOST_OS)_$(HOST_ARCH): | $(DOWNLOAD_DIR
580580
chmod +x $(outfile); \
581581
rm -f $(outfile).tar.gz
582582

583-
protoc_linux_amd64_SHA256SUM=e9c129c176bb7df02546c4cd6185126ca53c89e7d2f09511e209319704b5dd7e
584-
protoc_linux_arm64_SHA256SUM=4a802ed23d70f7bad7eb19e5a3e724b3aa967250d572cadfd537c1ba939aee6a
585-
protoc_darwin_amd64_SHA256SUM=f9caa5b4d0b537acffb0ffd7d53225511a5574ef903fca550ea9e7600987f13b
586-
protoc_darwin_arm64_SHA256SUM=a7b51b2113862690fa52c62f8891a6037bafb9db88d4f9924c486de9d9bb89d5
583+
protoc_linux_amd64_SHA256SUM=d99c011b799e9e412064244f0be417e5d76c9b6ace13a2ac735330fa7d57ad8f
584+
protoc_linux_arm64_SHA256SUM=4b96bc91f8b54d829b8c3ca2207ff1ceb774843321e4fa5a68502faece584272
585+
protoc_darwin_amd64_SHA256SUM=e4e50a703147a92d1a5a2d3a34c9e41717f67ade67d4be72b9a466eb8f22fe87
586+
protoc_darwin_arm64_SHA256SUM=3cf55dd47118bd2efda9cd26b74f8bbbfcf5beb1bf606bc56ad4c001b543f6d3
587587

588588
.PRECIOUS: $(DOWNLOAD_DIR)/tools/protoc@$(PROTOC_VERSION)_$(HOST_OS)_$(HOST_ARCH)
589589
$(DOWNLOAD_DIR)/tools/protoc@$(PROTOC_VERSION)_$(HOST_OS)_$(HOST_ARCH): | $(DOWNLOAD_DIR)/tools
@@ -593,7 +593,7 @@ $(DOWNLOAD_DIR)/tools/protoc@$(PROTOC_VERSION)_$(HOST_OS)_$(HOST_ARCH): | $(DOWN
593593
@source $(lock_script) $@; \
594594
$(CURL) https://github.com/protocolbuffers/protobuf/releases/download/$(PROTOC_VERSION)/protoc-$(PROTOC_VERSION:v%=%)-$(OS)-$(ARCH).zip -o $(outfile).zip; \
595595
$(checkhash_script) $(outfile).zip $(protoc_$(HOST_OS)_$(HOST_ARCH)_SHA256SUM); \
596-
unzip -qq -c $(outfile).zip bin/protoc > $(outfile); \
596+
unzip -p $(outfile).zip bin/protoc > $(outfile); \
597597
chmod +x $(outfile); \
598598
rm -f $(outfile).zip
599599

0 commit comments

Comments
 (0)