Skip to content

Commit d6bd6df

Browse files
Merge pull request #507 from cert-manager/self-upgrade-main
[CI] Merge self-upgrade-main into main
2 parents 0f3c8a9 + a1cfb96 commit d6bd6df

File tree

4 files changed

+55
-42
lines changed

4 files changed

+55
-42
lines changed

klone.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,70 +10,70 @@ targets:
1010
- folder_name: boilerplate
1111
repo_url: https://github.com/cert-manager/makefile-modules.git
1212
repo_ref: main
13-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
13+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
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: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
18+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
1919
repo_path: modules/cert-manager
2020
- folder_name: controller-gen
2121
repo_url: https://github.com/cert-manager/makefile-modules.git
2222
repo_ref: main
23-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
23+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
2424
repo_path: modules/controller-gen
2525
- folder_name: generate-verify
2626
repo_url: https://github.com/cert-manager/makefile-modules.git
2727
repo_ref: main
28-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
28+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
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: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
33+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
3434
repo_path: modules/go
3535
- folder_name: helm
3636
repo_url: https://github.com/cert-manager/makefile-modules.git
3737
repo_ref: main
38-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
38+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
3939
repo_path: modules/helm
4040
- folder_name: help
4141
repo_url: https://github.com/cert-manager/makefile-modules.git
4242
repo_ref: main
43-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
43+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
4444
repo_path: modules/help
4545
- folder_name: kind
4646
repo_url: https://github.com/cert-manager/makefile-modules.git
4747
repo_ref: main
48-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
48+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
4949
repo_path: modules/kind
5050
- folder_name: klone
5151
repo_url: https://github.com/cert-manager/makefile-modules.git
5252
repo_ref: main
53-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
53+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
5454
repo_path: modules/klone
5555
- folder_name: licenses
5656
repo_url: https://github.com/cert-manager/makefile-modules.git
5757
repo_ref: main
58-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
58+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
5959
repo_path: modules/licenses
6060
- folder_name: oci-build
6161
repo_url: https://github.com/cert-manager/makefile-modules.git
6262
repo_ref: main
63-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
63+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
6464
repo_path: modules/oci-build
6565
- folder_name: oci-publish
6666
repo_url: https://github.com/cert-manager/makefile-modules.git
6767
repo_ref: main
68-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
68+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
6969
repo_path: modules/oci-publish
7070
- folder_name: repository-base
7171
repo_url: https://github.com/cert-manager/makefile-modules.git
7272
repo_ref: main
73-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
73+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
7474
repo_path: modules/repository-base
7575
- folder_name: tools
7676
repo_url: https://github.com/cert-manager/makefile-modules.git
7777
repo_ref: main
78-
repo_hash: b28a6c7b188e2c3c6540779d4f036db4d54de9f1
78+
repo_hash: 737c51c1bf36dea15a7ef2bc5c070d09845530a2
7979
repo_path: modules/tools

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: 9 additions & 3 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
@@ -32,6 +30,7 @@ $(call fatal_if_undefined,build_names)
3230
# Set default config values
3331
CGO_ENABLED ?= 0
3432
GOEXPERIMENT ?= # empty by default
33+
oci_platforms ?= linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
3534

3635
# Default variables per build_names entry
3736
#
@@ -40,6 +39,7 @@ define default_per_build_variables
4039
go_$1_cgo_enabled ?= $(CGO_ENABLED)
4140
go_$1_goexperiment ?= $(GOEXPERIMENT)
4241
go_$1_flags ?= -tags=
42+
oci_$1_platforms ?= $(oci_platforms)
4343
oci_$1_additional_layers ?=
4444
oci_$1_linux_capabilities ?=
4545
oci_$1_build_args ?=
@@ -105,17 +105,23 @@ ifneq ($(words $(oci_$1_image_name_development)),1)
105105
$$(error oci_$1_image_name_development "$(oci_$1_image_name_development)" should be a single image name)
106106
endif
107107

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
108112
endef
109113

110114
$(foreach build_name,$(build_names),$(eval $(call check_per_build_variables,$(build_name))))
111115

112116
# Create variables holding targets
113117
#
114118
# We create the following targets for each $(build_names)
115-
# - 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))
116121
# - oci-load-$(build_name) = load the image into docker using the oci_$(build_name)_image_name_development variable
117122
# - docker-tarball-$(build_name) = build a "docker load" compatible tarball of the image
118123
oci_build_targets := $(build_names:%=oci-build-%)
124+
oci_build_targets += $(build_names:%=oci-build-%__local)
119125
oci_load_targets := $(build_names:%=oci-load-%)
120126
docker_tarball_targets := $(build_names:%=docker-tarball-%)
121127

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

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,54 @@ $(bin_dir)/scratch/image:
1717

1818
.PHONY: $(oci_build_targets)
1919
## 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))
2022
## @category [shared] Build
2123
$(oci_build_targets): oci-build-%: | $(NEEDS_KO) $(NEEDS_GO) $(NEEDS_YQ) $(NEEDS_IMAGE-TOOL) $(bin_dir)/scratch/image
22-
rm -rf $(CURDIR)/$(oci_layout_path_$*)
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)
2330

2431
echo '{}' | \
25-
$(YQ) '.defaultBaseImage = "$(oci_$*_base_image)"' | \
26-
$(YQ) '.builds[0].id = "$*"' | \
27-
$(YQ) '.builds[0].dir = "$(go_$*_mod_dir)"' | \
28-
$(YQ) '.builds[0].main = "$(go_$*_main_dir)"' | \
29-
$(YQ) '.builds[0].env[0] = "CGO_ENABLED=$(go_$*_cgo_enabled)"' | \
30-
$(YQ) '.builds[0].env[1] = "GOEXPERIMENT=$(go_$*_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)"' | \
3138
$(YQ) '.builds[0].ldflags[0] = "-s"' | \
3239
$(YQ) '.builds[0].ldflags[1] = "-w"' | \
3340
$(YQ) '.builds[0].ldflags[2] = "{{.Env.LDFLAGS}}"' | \
34-
$(YQ) '.builds[0].flags[0] = "$(go_$*_flags)"' | \
35-
$(YQ) '.builds[0].linux_capabilities = "$(oci_$*_linux_capabilities)"' \
36-
> $(CURDIR)/$(oci_layout_path_$*).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
3744

3845
GOWORK=off \
39-
KO_DOCKER_REPO=$(oci_$*_image_name_development) \
46+
KO_DOCKER_REPO=$(oci_$a_image_name_development) \
4047
KOCACHE=$(CURDIR)/$(bin_dir)/scratch/image/ko_cache \
41-
KO_CONFIG_PATH=$(CURDIR)/$(oci_layout_path_$*).ko_config.yaml \
48+
KO_CONFIG_PATH=$(CURDIR)/$(layout_path).ko_config.yaml \
4249
SOURCE_DATE_EPOCH=$(GITEPOCH) \
4350
KO_GO_PATH=$(GO) \
44-
LDFLAGS="$(go_$*_ldflags)" \
45-
$(KO) build $(go_$*_mod_dir)/$(go_$*_main_dir) \
46-
--platform=$(oci_platforms) \
47-
$(oci_$*_build_args) \
48-
--oci-layout-path=$(oci_layout_path_$*) \
49-
--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 \
5057
--sbom=spdx \
5158
--push=false \
5259
--bare
5360

5461
$(IMAGE-TOOL) append-layers \
55-
$(CURDIR)/$(oci_layout_path_$*) \
56-
$(oci_$*_additional_layers)
62+
$(CURDIR)/$(layout_path) \
63+
$(oci_$a_additional_layers)
5764

5865
$(IMAGE-TOOL) list-digests \
59-
$(CURDIR)/$(oci_layout_path_$*) \
60-
> $(oci_digest_path_$*)
66+
$(CURDIR)/$(layout_path) \
67+
> $(digest_path)
6168

6269
# Only include the oci-load target if kind is provided by the kind makefile-module
6370
ifdef kind_cluster_name
@@ -72,6 +79,5 @@ endif
7279
## Build Docker tarball image for the local architecture
7380
## @category [shared] Build
7481
.PHONY: $(docker_tarball_targets)
75-
$(docker_tarball_targets): oci_platforms := "linux/$(HOST_ARCH)"
76-
$(docker_tarball_targets): docker-tarball-%: oci-build-% | $(NEEDS_GO) $(NEEDS_IMAGE-TOOL)
77-
$(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)

0 commit comments

Comments
 (0)