Skip to content

Commit

Permalink
BOT: run 'make upgrade-klone' and 'make generate'
Browse files Browse the repository at this point in the history
Signed-off-by: cert-manager-bot <cert-manager-bot@users.noreply.github.com>
  • Loading branch information
cert-manager-bot committed May 6, 2024
1 parent e0c8623 commit c87d0bc
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 236 deletions.
2 changes: 0 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ linters:
- gocritic
- gofmt
- goheader
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ MAKECMDGOALS ?=
# binary may not be available in the PATH yet when the Makefiles are
# evaluated. HOST_OS and HOST_ARCH only support Linux, *BSD and macOS (M1
# and Intel).
HOST_OS ?= $(shell uname -s | tr A-Z a-z)
HOST_ARCH ?= $(shell uname -m)
host_os := $(shell uname -s | tr A-Z a-z)
host_arch := $(shell uname -m)
HOST_OS ?= $(host_os)
HOST_ARCH ?= $(host_arch)

ifeq (x86_64, $(HOST_ARCH))
HOST_ARCH = amd64
Expand All @@ -74,7 +76,8 @@ endif
# Git and versioning information #
##################################

VERSION ?= $(shell git describe --tags --always --match='v*' --abbrev=14 --dirty)
git_version := $(shell git describe --tags --always --match='v*' --abbrev=14 --dirty)
VERSION ?= $(git_version)
IS_PRERELEASE := $(shell git describe --tags --always --match='v*' --abbrev=0 | grep -q '-' && echo true || echo false)
GITCOMMIT := $(shell git rev-parse HEAD)
GITEPOCH := $(shell git show -s --format=%ct HEAD)
Expand Down
18 changes: 9 additions & 9 deletions klone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,45 @@ targets:
- folder_name: boilerplate
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/boilerplate
- folder_name: cert-manager
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/cert-manager
- folder_name: executable
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/executable
- folder_name: generate-verify
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/generate-verify
- folder_name: go
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/go
- folder_name: help
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/help
- folder_name: klone
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/klone
- folder_name: repository-base
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/repository-base
- folder_name: tools
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 9b0502fdd5860b18fd6a9ddf86f148604a214fe4
repo_hash: ed50ac284f8e2a389ee33d4dcb90eb4de108bb98
repo_path: modules/tools
2 changes: 0 additions & 2 deletions make/_shared/go/.golangci.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ linters:
- gocritic
- gofmt
- goheader
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
Expand Down
25 changes: 14 additions & 11 deletions make/_shared/go/01_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ shared_generate_targets += generate-govulncheck
# not want new vulnerabilities in existing code to block the merging of PRs.
# Instead `make verify-govulnecheck` is intended to be run periodically by a CI job.
verify-govulncheck: | $(NEEDS_GOVULNCHECK)
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) -printf '%h\n' \
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
| while read d; do \
echo "Running 'GOTOOLCHAIN=go$(VENDORED_GO_VERSION) $(bin_dir)/tools/govulncheck ./...' in directory '$${d}'"; \
pushd "$${d}" >/dev/null; \
target=$$(dirname $${d}); \
echo "Running 'GOTOOLCHAIN=go$(VENDORED_GO_VERSION) $(bin_dir)/tools/govulncheck ./...' in directory '$${target}'"; \
pushd "$${target}" >/dev/null; \
GOTOOLCHAIN=go$(VENDORED_GO_VERSION) $(GOVULNCHECK) ./... || exit; \
popd >/dev/null; \
echo ""; \
Expand All @@ -73,10 +74,11 @@ shared_generate_targets += generate-golangci-lint-config
## Verify all Go modules using golangci-lint
## @category [shared] Generate/ Verify
verify-golangci-lint: | $(NEEDS_GO) $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(bin_dir)/scratch
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) -printf '%h\n' \
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
| while read d; do \
echo "Running '$(bin_dir)/tools/golangci-lint run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config)' in directory '$${d}'"; \
pushd "$${d}" >/dev/null; \
target=$$(dirname $${d}); \
echo "Running '$(bin_dir)/tools/golangci-lint run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config)' in directory '$${target}'"; \
pushd "$${target}" >/dev/null; \
$(GOLANGCI-LINT) run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --timeout 4m || exit; \
popd >/dev/null; \
echo ""; \
Expand All @@ -87,18 +89,19 @@ shared_verify_targets_dirty += verify-golangci-lint
.PHONY: fix-golangci-lint
## Fix all Go modules using golangci-lint
## @category [shared] Generate/ Verify
fix-golangci-lint: | $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(bin_dir)/scratch
gci write \
fix-golangci-lint: | $(NEEDS_GOLANGCI-LINT) $(NEEDS_YQ) $(NEEDS_GCI) $(bin_dir)/scratch
$(GCI) write \
-s "standard" \
-s "default" \
-s "prefix($(repo_name))" \
-s "blank" \
-s "dot" .

@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) -printf '%h\n' \
@find . -name go.mod -not \( -path "./$(bin_dir)/*" -or -path "./make/_shared/*" \) \
| while read d; do \
echo "Running '$(bin_dir)/tools/golangci-lint run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --fix' in directory '$${d}'"; \
pushd "$${d}" >/dev/null; \
target=$$(dirname $${d}); \
echo "Running '$(bin_dir)/tools/golangci-lint run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --fix' in directory '$${target}'"; \
pushd "$${target}" >/dev/null; \
$(GOLANGCI-LINT) run --go $(VENDORED_GO_VERSION) -c $(CURDIR)/$(golangci_lint_config) --fix || exit; \
popd >/dev/null; \
echo ""; \
Expand Down
9 changes: 6 additions & 3 deletions make/_shared/repository-base/base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ MAKECMDGOALS ?=
# binary may not be available in the PATH yet when the Makefiles are
# evaluated. HOST_OS and HOST_ARCH only support Linux, *BSD and macOS (M1
# and Intel).
HOST_OS ?= $(shell uname -s | tr A-Z a-z)
HOST_ARCH ?= $(shell uname -m)
host_os := $(shell uname -s | tr A-Z a-z)
host_arch := $(shell uname -m)
HOST_OS ?= $(host_os)
HOST_ARCH ?= $(host_arch)

ifeq (x86_64, $(HOST_ARCH))
HOST_ARCH = amd64
Expand All @@ -74,7 +76,8 @@ endif
# Git and versioning information #
##################################

VERSION ?= $(shell git describe --tags --always --match='v*' --abbrev=14 --dirty)
git_version := $(shell git describe --tags --always --match='v*' --abbrev=14 --dirty)
VERSION ?= $(git_version)
IS_PRERELEASE := $(shell git describe --tags --always --match='v*' --abbrev=0 | grep -q '-' && echo true || echo false)
GITCOMMIT := $(shell git rev-parse HEAD)
GITEPOCH := $(shell git show -s --format=%ct HEAD)
Expand Down
Loading

0 comments on commit c87d0bc

Please sign in to comment.