Skip to content

Commit db456d0

Browse files
committed
run 'make upgrade-klone' and 'make generate'
Signed-off-by: Tim Ramlot <[email protected]>
1 parent 2e437f5 commit db456d0

File tree

12 files changed

+134
-131
lines changed

12 files changed

+134
-131
lines changed

.github/workflows/make-self-upgrade.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
exit 1
3333
3434
- name: Octo STS Token Exchange
35-
uses: octo-sts/action@a26b0c6455c7f13316f29a8766287f939e75f6c8 # v1.0.2
35+
uses: octo-sts/action@d6c70ad3b9ac85df6da6b9749014d7283987cfec # v1.0.3
3636
id: octo-sts
3737
with:
3838
scope: 'jetstack/jetstack-secure'

.github/workflows/renovate.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
exit 1
2828
2929
- name: Octo STS Token Exchange
30-
uses: octo-sts/action@a26b0c6455c7f13316f29a8766287f939e75f6c8 # v1.0.2
30+
uses: octo-sts/action@d6c70ad3b9ac85df6da6b9749014d7283987cfec # v1.0.3
3131
id: octo-sts
3232
with:
3333
scope: 'jetstack/jetstack-secure'
@@ -50,7 +50,7 @@ jobs:
5050
go-version: ${{ steps.go-version.outputs.result }}
5151

5252
- name: Self-hosted Renovate
53-
uses: renovatebot/github-action@70ea19f1b0dc8a9cc7af1b4278f8d3fd9778b577 # v43.0.17
53+
uses: renovatebot/github-action@c5fdc9f98fdf9e9bb16b5760f7e560256eb79326 # v44.0.2
5454
with:
5555
configurationFile: .github/renovate.json5
5656
token: ${{ steps.octo-sts.outputs.token }}

.golangci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ linters:
5454
- makezero
5555
- mirror
5656
- misspell
57+
- modernize
5758
- musttag
5859
- nakedret
5960
- nilerr
@@ -81,9 +82,10 @@ formatters:
8182
sections:
8283
- standard # Standard section: captures all standard packages.
8384
- default # Default section: contains all imports that could not be matched to another section type.
84-
- prefix(github.com/jetstack/preflight) # Custom section: groups all imports with the specified Prefix.
85+
- localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
8586
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
8687
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
88+
custom-order: true
8789
exclusions:
8890
generated: lax
8991
paths: [third_party, builtin$, examples$]

klone.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,55 @@ targets:
1010
- folder_name: generate-verify
1111
repo_url: https://github.com/cert-manager/makefile-modules.git
1212
repo_ref: main
13-
repo_hash: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
13+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
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: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
18+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
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: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
23+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
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: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
28+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
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: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
33+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
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: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
38+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
3939
repo_path: modules/klone
4040
- folder_name: licenses
4141
repo_url: https://github.com/cert-manager/makefile-modules.git
4242
repo_ref: main
43-
repo_hash: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
43+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
4444
repo_path: modules/licenses
4545
- folder_name: oci-build
4646
repo_url: https://github.com/cert-manager/makefile-modules.git
4747
repo_ref: main
48-
repo_hash: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
48+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
4949
repo_path: modules/oci-build
5050
- folder_name: oci-publish
5151
repo_url: https://github.com/cert-manager/makefile-modules.git
5252
repo_ref: main
53-
repo_hash: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
53+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
5454
repo_path: modules/oci-publish
5555
- folder_name: repository-base
5656
repo_url: https://github.com/cert-manager/makefile-modules.git
5757
repo_ref: main
58-
repo_hash: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
58+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
5959
repo_path: modules/repository-base
6060
- folder_name: tools
6161
repo_url: https://github.com/cert-manager/makefile-modules.git
6262
repo_ref: main
63-
repo_hash: 3640ec2744eca6198a647fa0cd6ca09536aa4f8e
63+
repo_hash: 4479013f57fb2f7f0f28b4e951dc1ba6e6badddc
6464
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/licenses/01_mod.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ oci-license-layer-$1: | $(bin_dir)/scratch $(NEEDS_GO-LICENSES)
6868
cp $$(go_$1_mod_dir)/LICENSES $$(license_layer_path_$1)/licenses/LICENSES
6969

7070
oci-build-$1: oci-license-layer-$1
71+
oci-build-$1__local: oci-license-layer-$1
7172
oci_$1_additional_layers += $$(license_layer_path_$1)
7273
endef
7374

make/_shared/oci-build/00_mod.mk

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
oci_platforms ?= linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
16-
1715
# Use distroless as minimal base image to package the manager binary
1816
# To get latest SHA run "crane digest quay.io/jetstack/base-static:latest"
1917
base_image_static := quay.io/jetstack/base-static@sha256:1da2e7de36c9d7a1931d765e8054a3c9fe7ed5126bacf728bb7429e923386146
@@ -27,12 +25,12 @@ fatal_if_undefined = $(if $(findstring undefined,$(origin $1)),$(error $1 is not
2725
fatal_if_deprecated_defined = $(if $(findstring undefined,$(origin $1)),,$(error $1 is deprecated, use $2 instead))
2826

2927
# Validate globals that are required
30-
$(call fatal_if_undefined,bin_dir)
3128
$(call fatal_if_undefined,build_names)
3229

3330
# Set default config values
3431
CGO_ENABLED ?= 0
3532
GOEXPERIMENT ?= # empty by default
33+
oci_platforms ?= linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
3634

3735
# Default variables per build_names entry
3836
#
@@ -41,6 +39,7 @@ define default_per_build_variables
4139
go_$1_cgo_enabled ?= $(CGO_ENABLED)
4240
go_$1_goexperiment ?= $(GOEXPERIMENT)
4341
go_$1_flags ?= -tags=
42+
oci_$1_platforms ?= $(oci_platforms)
4443
oci_$1_additional_layers ?=
4544
oci_$1_linux_capabilities ?=
4645
oci_$1_build_args ?=
@@ -98,37 +97,39 @@ ifeq ($(wildcard $(go_$1_mod_dir)/go.mod),)
9897
$$(error go_$1_mod_dir "$(go_$1_mod_dir)" does not contain a go.mod file)
9998
endif
10099
ifeq ($(wildcard $(go_$1_mod_dir)/$(go_$1_main_dir)/main.go),)
101-
$$(error go_$1_main_dir "$(go_$1_mod_dir)" does not contain a main.go file)
100+
$$(error go_$1_main_dir "$(go_$1_mod_dir)/$(go_$1_main_dir)" does not contain a main.go file)
102101
endif
103102

104103
# Validate the config required to build OCI images
105104
ifneq ($(words $(oci_$1_image_name_development)),1)
106105
$$(error oci_$1_image_name_development "$(oci_$1_image_name_development)" should be a single image name)
107106
endif
108107

108+
# Validate that the build name does not end in __local
109+
ifeq ($(1:%__local=__local),__local)
110+
$$(error build_name "$1" SHOULD NOT end in __local)
111+
endif
109112
endef
110113

111114
$(foreach build_name,$(build_names),$(eval $(call check_per_build_variables,$(build_name))))
112115

113116
# Create variables holding targets
114117
#
115118
# We create the following targets for each $(build_names)
116-
# - oci-build-$(build_name) = build the oci directory
119+
# - oci-build-$(build_name) = build the oci directory (multi-arch)
120+
# - oci-build-$(build_name)__local = build the oci directory (local arch: linux/$(HOST_ARCH))
117121
# - oci-load-$(build_name) = load the image into docker using the oci_$(build_name)_image_name_development variable
118122
# - docker-tarball-$(build_name) = build a "docker load" compatible tarball of the image
119-
# - ko-config-$(build_name) = generate "ko" config for a given build
120123
oci_build_targets := $(build_names:%=oci-build-%)
124+
oci_build_targets += $(build_names:%=oci-build-%__local)
121125
oci_load_targets := $(build_names:%=oci-load-%)
122126
docker_tarball_targets := $(build_names:%=docker-tarball-%)
123-
ko_config_targets := $(build_names:%=ko-config-%)
124127

125128
# Derive config based on user config
126129
#
127130
# - oci_layout_path_$(build_name) = path that the OCI image will be saved in OCI layout directory format
128131
# - oci_digest_path_$(build_name) = path to the file that will contain the digests
129-
# - ko_config_path_$(build_name) = path to the ko config file
130132
# - docker_tarball_path_$(build_name) = path that the docker tarball that the docker-tarball-$(build_name) will produce
131133
$(foreach build_name,$(build_names),$(eval oci_layout_path_$(build_name) := $(bin_dir)/scratch/image/oci-layout-$(build_name)))
132134
$(foreach build_name,$(build_names),$(eval oci_digest_path_$(build_name) := $(CURDIR)/$(oci_layout_path_$(build_name)).digests))
133-
$(foreach build_name,$(build_names),$(eval ko_config_path_$(build_name) := $(CURDIR)/$(oci_layout_path_$(build_name)).ko_config.yaml))
134135
$(foreach build_name,$(build_names),$(eval docker_tarball_path_$(build_name) := $(CURDIR)/$(oci_layout_path_$(build_name)).docker.tar))

make/_shared/oci-build/01_mod.mk

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,57 +15,56 @@
1515
$(bin_dir)/scratch/image:
1616
@mkdir -p $@
1717

18-
define ko_config_target
19-
.PHONY: $(ko_config_path_$1:$(CURDIR)/%=%)
20-
$(ko_config_path_$1:$(CURDIR)/%=%): | $(NEEDS_YQ) $(bin_dir)/scratch/image
18+
.PHONY: $(oci_build_targets)
19+
## Build the OCI image.
20+
## - oci-build-$(build_name) = build the oci directory (multi-arch)
21+
## - oci-build-$(build_name)__local = build the oci directory (local arch: linux/$(HOST_ARCH))
22+
## @category [shared] Build
23+
$(oci_build_targets): oci-build-%: | $(NEEDS_KO) $(NEEDS_GO) $(NEEDS_YQ) $(NEEDS_IMAGE-TOOL) $(bin_dir)/scratch/image
24+
$(eval a := $(patsubst %__local,%,$*))
25+
$(eval is_local := $(if $(findstring $a__local,$*),true))
26+
$(eval layout_path := $(if $(is_local),$(oci_layout_path_$a).local,$(oci_layout_path_$a)))
27+
$(eval digest_path := $(if $(is_local),$(oci_digest_path_$a).local,$(oci_digest_path_$a)))
28+
29+
rm -rf $(CURDIR)/$(layout_path)
30+
2131
echo '{}' | \
22-
$(YQ) '.defaultBaseImage = "$(oci_$1_base_image)"' | \
23-
$(YQ) '.builds[0].id = "$1"' | \
24-
$(YQ) '.builds[0].dir = "$(go_$1_mod_dir)"' | \
25-
$(YQ) '.builds[0].main = "$(go_$1_main_dir)"' | \
26-
$(YQ) '.builds[0].env[0] = "CGO_ENABLED=$(go_$1_cgo_enabled)"' | \
27-
$(YQ) '.builds[0].env[1] = "GOEXPERIMENT=$(go_$1_goexperiment)"' | \
32+
$(YQ) '.defaultBaseImage = "$(oci_$a_base_image)"' | \
33+
$(YQ) '.builds[0].id = "$a"' | \
34+
$(YQ) '.builds[0].dir = "$(go_$a_mod_dir)"' | \
35+
$(YQ) '.builds[0].main = "$(go_$a_main_dir)"' | \
36+
$(YQ) '.builds[0].env[0] = "CGO_ENABLED=$(go_$a_cgo_enabled)"' | \
37+
$(YQ) '.builds[0].env[1] = "GOEXPERIMENT=$(go_$a_goexperiment)"' | \
2838
$(YQ) '.builds[0].ldflags[0] = "-s"' | \
2939
$(YQ) '.builds[0].ldflags[1] = "-w"' | \
3040
$(YQ) '.builds[0].ldflags[2] = "{{.Env.LDFLAGS}}"' | \
31-
$(YQ) '.builds[0].flags[0] = "$(go_$1_flags)"' | \
32-
$(YQ) '.builds[0].linux_capabilities = "$(oci_$1_linux_capabilities)"' \
33-
> $(CURDIR)/$(oci_layout_path_$1).ko_config.yaml
41+
$(YQ) '.builds[0].flags[0] = "$(go_$a_flags)"' | \
42+
$(YQ) '.builds[0].linux_capabilities = "$(oci_$a_linux_capabilities)"' \
43+
> $(CURDIR)/$(layout_path).ko_config.yaml
3444

35-
ko-config-$1: $(ko_config_path_$1:$(CURDIR)/%=%)
36-
endef
37-
38-
.PHONY: $(ko_config_targets)
39-
$(foreach build_name,$(build_names),$(eval $(call ko_config_target,$(build_name))))
40-
41-
.PHONY: $(oci_build_targets)
42-
## Build the OCI image.
43-
## @category [shared] Build
44-
$(oci_build_targets): oci-build-%: ko-config-% | $(NEEDS_KO) $(NEEDS_GO) $(NEEDS_YQ) $(NEEDS_IMAGE-TOOL) $(bin_dir)/scratch/image
45-
rm -rf $(CURDIR)/$(oci_layout_path_$*)
4645
GOWORK=off \
47-
KO_DOCKER_REPO=$(oci_$*_image_name_development) \
46+
KO_DOCKER_REPO=$(oci_$a_image_name_development) \
4847
KOCACHE=$(CURDIR)/$(bin_dir)/scratch/image/ko_cache \
49-
KO_CONFIG_PATH=$(ko_config_path_$*) \
48+
KO_CONFIG_PATH=$(CURDIR)/$(layout_path).ko_config.yaml \
5049
SOURCE_DATE_EPOCH=$(GITEPOCH) \
5150
KO_GO_PATH=$(GO) \
52-
LDFLAGS="$(go_$*_ldflags)" \
53-
$(KO) build $(go_$*_mod_dir)/$(go_$*_main_dir) \
54-
--platform=$(oci_platforms) \
55-
$(oci_$*_build_args) \
56-
--oci-layout-path=$(oci_layout_path_$*) \
57-
--sbom-dir=$(CURDIR)/$(oci_layout_path_$*).sbom \
51+
LDFLAGS="$(go_$a_ldflags)" \
52+
$(KO) build $(go_$a_mod_dir)/$(go_$a_main_dir) \
53+
--platform=$(if $(is_local),linux/$(HOST_ARCH),$(oci_$a_platforms)) \
54+
$(oci_$a_build_args) \
55+
--oci-layout-path=$(layout_path) \
56+
--sbom-dir=$(CURDIR)/$(layout_path).sbom \
5857
--sbom=spdx \
5958
--push=false \
6059
--bare
6160

6261
$(IMAGE-TOOL) append-layers \
63-
$(CURDIR)/$(oci_layout_path_$*) \
64-
$(oci_$*_additional_layers)
62+
$(CURDIR)/$(layout_path) \
63+
$(oci_$a_additional_layers)
6564

6665
$(IMAGE-TOOL) list-digests \
67-
$(CURDIR)/$(oci_layout_path_$*) \
68-
> $(oci_digest_path_$*)
66+
$(CURDIR)/$(layout_path) \
67+
> $(digest_path)
6968

7069
# Only include the oci-load target if kind is provided by the kind makefile-module
7170
ifdef kind_cluster_name
@@ -80,6 +79,5 @@ endif
8079
## Build Docker tarball image for the local architecture
8180
## @category [shared] Build
8281
.PHONY: $(docker_tarball_targets)
83-
$(docker_tarball_targets): oci_platforms := "linux/$(HOST_ARCH)"
84-
$(docker_tarball_targets): docker-tarball-%: oci-build-% | $(NEEDS_GO) $(NEEDS_IMAGE-TOOL)
85-
$(IMAGE-TOOL) convert-to-docker-tar $(CURDIR)/$(oci_layout_path_$*) $(docker_tarball_path_$*) $(oci_$*_image_name_development):$(oci_$*_image_tag)
82+
$(docker_tarball_targets): docker-tarball-%: oci-build-%__local | $(NEEDS_GO) $(NEEDS_IMAGE-TOOL)
83+
$(IMAGE-TOOL) convert-to-docker-tar $(CURDIR)/$(oci_layout_path_$*).local $(docker_tarball_path_$*) $(oci_$*_image_name_development):$(oci_$*_image_tag)

make/_shared/repository-base/base/.github/workflows/make-self-upgrade.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
exit 1
3333
3434
- name: Octo STS Token Exchange
35-
uses: octo-sts/action@a26b0c6455c7f13316f29a8766287f939e75f6c8 # v1.0.2
35+
uses: octo-sts/action@d6c70ad3b9ac85df6da6b9749014d7283987cfec # v1.0.3
3636
id: octo-sts
3737
with:
3838
scope: '{{REPLACE:GH-REPOSITORY}}'

0 commit comments

Comments
 (0)