Skip to content

Commit 4876ec9

Browse files
BOT: run 'make upgrade-klone' and 'make generate'
Signed-off-by: cert-manager-bot <cert-manager-bot@users.noreply.github.com>
1 parent d44f654 commit 4876ec9

File tree

3 files changed

+61
-49
lines changed

3 files changed

+61
-49
lines changed

klone.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,35 @@ targets:
1010
- folder_name: boilerplate
1111
repo_url: https://github.com/cert-manager/makefile-modules.git
1212
repo_ref: main
13-
repo_hash: adb1dd2ffdb07aae9aea40c201633c7ae59714d8
13+
repo_hash: 652f41ca2a789690977902191af89b423482853f
1414
repo_path: modules/boilerplate
1515
- folder_name: generate-verify
1616
repo_url: https://github.com/cert-manager/makefile-modules.git
1717
repo_ref: main
18-
repo_hash: adb1dd2ffdb07aae9aea40c201633c7ae59714d8
18+
repo_hash: 652f41ca2a789690977902191af89b423482853f
1919
repo_path: modules/generate-verify
2020
- folder_name: go
2121
repo_url: https://github.com/cert-manager/makefile-modules.git
2222
repo_ref: main
23-
repo_hash: adb1dd2ffdb07aae9aea40c201633c7ae59714d8
23+
repo_hash: 652f41ca2a789690977902191af89b423482853f
2424
repo_path: modules/go
2525
- folder_name: help
2626
repo_url: https://github.com/cert-manager/makefile-modules.git
2727
repo_ref: main
28-
repo_hash: adb1dd2ffdb07aae9aea40c201633c7ae59714d8
28+
repo_hash: 652f41ca2a789690977902191af89b423482853f
2929
repo_path: modules/help
3030
- folder_name: klone
3131
repo_url: https://github.com/cert-manager/makefile-modules.git
3232
repo_ref: main
33-
repo_hash: adb1dd2ffdb07aae9aea40c201633c7ae59714d8
33+
repo_hash: 652f41ca2a789690977902191af89b423482853f
3434
repo_path: modules/klone
3535
- folder_name: repository-base
3636
repo_url: https://github.com/cert-manager/makefile-modules.git
3737
repo_ref: main
38-
repo_hash: adb1dd2ffdb07aae9aea40c201633c7ae59714d8
38+
repo_hash: 652f41ca2a789690977902191af89b423482853f
3939
repo_path: modules/repository-base
4040
- folder_name: tools
4141
repo_url: https://github.com/cert-manager/makefile-modules.git
4242
repo_ref: main
43-
repo_hash: adb1dd2ffdb07aae9aea40c201633c7ae59714d8
43+
repo_hash: 652f41ca2a789690977902191af89b423482853f
4444
repo_path: modules/tools

make/_shared/go/01_mod.mk

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,41 @@ endif
2323
go_base_dir := $(dir $(lastword $(MAKEFILE_LIST)))/base/
2424
golangci_lint_override := $(dir $(lastword $(MAKEFILE_LIST)))/.golangci.override.yaml
2525

26+
.PHONY: go-workspace
27+
go-workspace: export GOWORK?=$(abspath go.work)
28+
## Create a go.work file in the repository root (or GOWORK)
29+
##
30+
## @category Development
31+
go-workspace: | $(NEEDS_GO)
32+
@rm -f $(GOWORK)
33+
$(GO) work init
34+
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
35+
| while read d; do \
36+
target=$$(dirname $${d}); \
37+
$(GO) work use "$${target}"; \
38+
done
39+
40+
.PHONY: go-tidy
41+
## Alias for `make generate-go-mod-tidy`
42+
## @category [shared] Generate/ Verify
43+
go-tidy: generate-go-mod-tidy
44+
45+
.PHONY: generate-go-mod-tidy
46+
## Run `go mod tidy` on all Go modules
47+
## @category [shared] Generate/ Verify
48+
generate-go-mod-tidy: | $(NEEDS_GO)
49+
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
50+
| while read d; do \
51+
target=$$(dirname $${d}); \
52+
echo "Running 'go mod tidy' in directory '$${target}'"; \
53+
pushd "$${target}" >/dev/null; \
54+
$(GO) mod tidy || exit; \
55+
popd >/dev/null; \
56+
echo ""; \
57+
done
58+
59+
shared_generate_targets += generate-go-mod-tidy
60+
2661
.PHONY: generate-govulncheck
2762
## Generate base files in the repository
2863
## @category [shared] Generate/ Verify

make/_shared/tools/00_mod.mk

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ for_each_kv = $(foreach item,$2,$(eval $(call $1,$(word 1,$(subst =, ,$(item))),
4242
# variables: https://stackoverflow.com/questions/54726457
4343
export PATH := $(CURDIR)/$(bin_dir)/tools:$(PATH)
4444

45-
CTR=docker
45+
CTR ?= docker
46+
.PHONY: __require-ctr
47+
ifneq ($(shell command -v $(CTR) >/dev/null || echo notfound),)
48+
__require-ctr:
49+
@:$(error "$(CTR) (or set CTR to a docker-compatible tool)")
50+
endif
51+
NEEDS_CTR = __require-ctr
4652

4753
tools :=
4854
# https://github.com/helm/helm/releases
@@ -153,7 +159,7 @@ ADDITIONAL_TOOLS ?=
153159
tools += $(ADDITIONAL_TOOLS)
154160

155161
# https://go.dev/dl/
156-
VENDORED_GO_VERSION := 1.22.4
162+
VENDORED_GO_VERSION := 1.22.5
157163

158164
# Print the go version which can be used in GH actions
159165
.PHONY: print-go-version
@@ -241,8 +247,13 @@ detected_vendoring := $(findstring vendor-go,$(MAKECMDGOALS))$(shell [ -f $(bin_
241247
export VENDOR_GO ?= $(detected_vendoring)
242248

243249
ifeq ($(VENDOR_GO),)
250+
.PHONY: __require-go
251+
ifneq ($(shell command -v go >/dev/null || echo notfound),)
252+
__require-go:
253+
@:$(error "$(GO) (or run 'make vendor-go')")
254+
endif
244255
GO := go
245-
NEEDS_GO := #
256+
NEEDS_GO = __require-go
246257
else
247258
export GOROOT := $(CURDIR)/$(bin_dir)/tools/goroot
248259
export PATH := $(CURDIR)/$(bin_dir)/tools/goroot/bin:$(PATH)
@@ -363,10 +374,10 @@ $(call for_each_kv,go_dependency,$(go_dependencies))
363374
# File downloads #
364375
##################
365376

366-
go_linux_amd64_SHA256SUM=ba79d4526102575196273416239cca418a651e049c2b099f3159db85e7bade7d
367-
go_linux_arm64_SHA256SUM=a8e177c354d2e4a1b61020aca3562e27ea3e8f8247eca3170e3fa1e0c2f9e771
368-
go_darwin_amd64_SHA256SUM=c95967f50aa4ace34af0c236cbdb49a9a3e80ee2ad09d85775cb4462a5c19ed3
369-
go_darwin_arm64_SHA256SUM=242b78dc4c8f3d5435d28a0d2cec9b4c1aa999b601fb8aa59fb4e5a1364bf827
377+
go_linux_amd64_SHA256SUM=904b924d435eaea086515bc63235b192ea441bd8c9b198c507e85009e6e4c7f0
378+
go_linux_arm64_SHA256SUM=8d21325bfcf431be3660527c1a39d3d9ad71535fabdf5041c826e44e31642b5a
379+
go_darwin_amd64_SHA256SUM=95d9933cdcf45f211243c42c7705c37353cccd99f27eb4d8e2d1bf2f4165cb50
380+
go_darwin_arm64_SHA256SUM=4cd1bcb05be03cecb77bccd765785d5ff69d79adf4dd49790471d00c06b41133
370381

371382
.PRECIOUS: $(DOWNLOAD_DIR)/tools/go@$(VENDORED_GO_VERSION)_$(HOST_OS)_$(HOST_ARCH).tar.gz
372383
$(DOWNLOAD_DIR)/tools/go@$(VENDORED_GO_VERSION)_$(HOST_OS)_$(HOST_ARCH).tar.gz: | $(DOWNLOAD_DIR)/tools
@@ -604,10 +615,7 @@ $(DOWNLOAD_DIR)/tools/preflight@$(PREFLIGHT_VERSION)_linux_$(HOST_ARCH): | $(DOW
604615
missing=$(shell (command -v curl >/dev/null || echo curl) \
605616
&& (command -v sha256sum >/dev/null || command -v shasum >/dev/null || echo sha256sum) \
606617
&& (command -v git >/dev/null || echo git) \
607-
&& (command -v rsync >/dev/null || echo rsync) \
608-
&& ([ -n "$(findstring vendor-go,$(MAKECMDGOALS),)" ] \
609-
|| command -v $(GO) >/dev/null || echo "$(GO) (or run 'make vendor-go')") \
610-
&& (command -v $(CTR) >/dev/null || echo "$(CTR) (or set CTR to a docker-compatible tool)"))
618+
&& (command -v rsync >/dev/null || echo rsync))
611619
ifneq ($(missing),)
612620
$(error Missing required tools: $(missing))
613621
endif
@@ -616,34 +624,3 @@ endif
616624
## Download and setup all tools
617625
## @category [shared] Tools
618626
tools: $(tools_paths)
619-
620-
self_file := $(dir $(lastword $(MAKEFILE_LIST)))/00_mod.mk
621-
622-
# see https://stackoverflow.com/a/53408233
623-
sed_inplace := sed -i''
624-
ifeq ($(HOST_OS),darwin)
625-
sed_inplace := sed -i ''
626-
endif
627-
628-
# This target is used to learn the sha256sum of the tools. It is used only
629-
# in the makefile-modules repo, and should not be used in any other repo.
630-
.PHONY: tools-learn-sha
631-
tools-learn-sha: | $(bin_dir)
632-
rm -rf ./$(bin_dir)/
633-
mkdir -p ./$(bin_dir)/scratch/
634-
$(eval export LEARN_FILE=$(CURDIR)/$(bin_dir)/scratch/learn_tools_file)
635-
echo -n "" > "$(LEARN_FILE)"
636-
637-
HOST_OS=linux HOST_ARCH=amd64 $(MAKE) tools
638-
HOST_OS=linux HOST_ARCH=arm64 $(MAKE) tools
639-
HOST_OS=darwin HOST_ARCH=amd64 $(MAKE) tools
640-
HOST_OS=darwin HOST_ARCH=arm64 $(MAKE) tools
641-
642-
HOST_OS=linux HOST_ARCH=amd64 $(MAKE) vendor-go
643-
HOST_OS=linux HOST_ARCH=arm64 $(MAKE) vendor-go
644-
HOST_OS=darwin HOST_ARCH=amd64 $(MAKE) vendor-go
645-
HOST_OS=darwin HOST_ARCH=arm64 $(MAKE) vendor-go
646-
647-
while read p; do \
648-
$(sed_inplace) "$$p" $(self_file); \
649-
done <"$(LEARN_FILE)"

0 commit comments

Comments
 (0)