Skip to content

Commit

Permalink
Merge pull request #6980 from cert-manager/self-upgrade-master
Browse files Browse the repository at this point in the history
[CI] Merge self-upgrade-master into master
  • Loading branch information
cert-manager-prow[bot] committed May 2, 2024
2 parents 5ec485d + f249cb6 commit aa17b34
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 210 deletions.
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
14 changes: 7 additions & 7 deletions klone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ targets:
- folder_name: boilerplate
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: f053c2c92459763f424280dde8190aae674743b9
repo_hash: 23b4de4ac804dff0e4e2fd687b5a04631b912dea
repo_path: modules/boilerplate
- folder_name: generate-verify
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: f053c2c92459763f424280dde8190aae674743b9
repo_hash: 23b4de4ac804dff0e4e2fd687b5a04631b912dea
repo_path: modules/generate-verify
- folder_name: go
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: f053c2c92459763f424280dde8190aae674743b9
repo_hash: 23b4de4ac804dff0e4e2fd687b5a04631b912dea
repo_path: modules/go
- folder_name: help
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: f053c2c92459763f424280dde8190aae674743b9
repo_hash: 23b4de4ac804dff0e4e2fd687b5a04631b912dea
repo_path: modules/help
- folder_name: klone
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: f053c2c92459763f424280dde8190aae674743b9
repo_hash: 23b4de4ac804dff0e4e2fd687b5a04631b912dea
repo_path: modules/klone
- folder_name: repository-base
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: f053c2c92459763f424280dde8190aae674743b9
repo_hash: 23b4de4ac804dff0e4e2fd687b5a04631b912dea
repo_path: modules/repository-base
- folder_name: tools
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: f053c2c92459763f424280dde8190aae674743b9
repo_hash: 23b4de4ac804dff0e4e2fd687b5a04631b912dea
repo_path: modules/tools
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

0 comments on commit aa17b34

Please sign in to comment.