Skip to content

Commit a0b035a

Browse files
authored
Merge pull request #18 from cert-manager/self-upgrade
[CI] Merge self-upgrade into main
2 parents ce56378 + 7c9d8d7 commit a0b035a

File tree

11 files changed

+284
-68
lines changed

11 files changed

+284
-68
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ noop: # do nothing
4949
# and Intel).
5050
HOST_OS ?= $(shell uname -s | tr A-Z a-z)
5151
HOST_ARCH ?= $(shell uname -m)
52+
5253
ifeq (x86_64, $(HOST_ARCH))
5354
HOST_ARCH = amd64
55+
else ifeq (aarch64, $(HOST_ARCH))
56+
# linux reports the arm64 arch as aarch64
57+
HOST_ARCH = arm64
5458
endif
5559

5660
##################################

OWNERS_ALIASES

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
2+
# Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/repository-base/base/OWNERS_ALIASES instead.
3+
4+
aliases:
5+
cm-maintainers:
6+
- munnerz
7+
- joshvanl
8+
- wallrj
9+
- jakexks
10+
- maelvls
11+
- irbekrm
12+
- sgtcodfish
13+
- inteon

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: dc8ce162c76ca7b95f80157aefa4afb9d2783b82
13+
repo_hash: 2d17d1af47e0c904fb46ade54df9101751d19251
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: dc8ce162c76ca7b95f80157aefa4afb9d2783b82
18+
repo_hash: 2d17d1af47e0c904fb46ade54df9101751d19251
1919
repo_path: modules/generate-verify
2020
- folder_name: help
2121
repo_url: https://github.com/cert-manager/makefile-modules.git
2222
repo_ref: main
23-
repo_hash: dc8ce162c76ca7b95f80157aefa4afb9d2783b82
23+
repo_hash: 2d17d1af47e0c904fb46ade54df9101751d19251
2424
repo_path: modules/help
2525
- folder_name: klone
2626
repo_url: https://github.com/cert-manager/makefile-modules.git
2727
repo_ref: main
28-
repo_hash: dc8ce162c76ca7b95f80157aefa4afb9d2783b82
28+
repo_hash: 2d17d1af47e0c904fb46ade54df9101751d19251
2929
repo_path: modules/klone
3030
- folder_name: oci-image
3131
repo_url: https://github.com/cert-manager/makefile-modules.git
3232
repo_ref: main
33-
repo_hash: dc8ce162c76ca7b95f80157aefa4afb9d2783b82
33+
repo_hash: 2d17d1af47e0c904fb46ade54df9101751d19251
3434
repo_path: modules/oci-image
3535
- folder_name: repository-base
3636
repo_url: https://github.com/cert-manager/makefile-modules.git
3737
repo_ref: main
38-
repo_hash: dc8ce162c76ca7b95f80157aefa4afb9d2783b82
38+
repo_hash: 2d17d1af47e0c904fb46ade54df9101751d19251
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: dc8ce162c76ca7b95f80157aefa4afb9d2783b82
43+
repo_hash: 2d17d1af47e0c904fb46ade54df9101751d19251
4444
repo_path: modules/tools

make/_shared/generate-verify/00_mod.mk

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

15-
# Shared targets are set by other Makefile modules.
1615
shared_generate_targets ?=
16+
shared_verify_targets ?=
1717
shared_verify_targets_dirty ?=
18-
19-
# Extra targets are set by the Makefiles in the project.
20-
extra_generate_targets ?=
21-
extra_verify_targets ?=
22-
extra_verify_targets_dirty ?=

make/_shared/generate-verify/02_mod.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
.PHONY: generate
1616
## Generate all generate targets.
1717
## @category [shared] Generate/ Verify
18-
generate: $(shared_generate_targets) $(extra_generate_targets)
18+
generate: $(shared_generate_targets)
1919

2020
verify_script := $(dir $(lastword $(MAKEFILE_LIST)))/util/verify.sh
2121

@@ -26,6 +26,6 @@ verify-%: FORCE
2626
.PHONY: verify
2727
## Verify code and generate targets.
2828
## @category [shared] Generate/ Verify
29-
verify: $(shared_generate_targets:%=verify-%) $(extra_generate_targets:%=verify-%) $(shared_verify_targets) $(extra_verify_targets)
29+
verify: $(shared_generate_targets:%=verify-%) $(shared_verify_targets)
3030
@echo "The following targets create temporary files in the current directory, that is why they have to be run last:"
31-
$(MAKE) noop $(shared_verify_targets_dirty) $(extra_verify_targets_dirty)
31+
$(MAKE) noop $(shared_verify_targets_dirty)

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

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

15-
oci_platforms := all
15+
oci_platforms := linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
1616

1717
# Use distroless as minimal base image to package the manager binary
1818
# Refer to https://github.com/GoogleContainerTools/distroless for more details
@@ -54,50 +54,31 @@ $(foreach build_name,$(build_names),$(eval $(call check_variables,$(build_name))
5454

5555
##########################################
5656

57+
RELEASE_DRYRUN ?= false
58+
5759
CGO_ENABLED ?= 0
60+
GOEXPERIMENT ?= # empty by default
5861

59-
build_targets := $(build_names:%=$(bin_dir)/bin/%)
60-
run_targets := $(build_names:%=run-%)
6162
oci_build_targets := $(build_names:%=oci-build-%)
6263
oci_push_targets := $(build_names:%=oci-push-%)
6364
oci_maybe_push_targets := $(build_names:%=oci-maybe-push-%)
6465
oci_load_targets := $(build_names:%=oci-load-%)
6566

6667
image_tool_dir := $(dir $(lastword $(MAKEFILE_LIST)))/image_tool/
6768

68-
$(bin_dir)/bin:
69-
mkdir -p $@
70-
71-
## Build manager binary.
72-
## @category [shared] Build
73-
$(build_targets): $(bin_dir)/bin/%: FORCE | $(NEEDS_GO) $(bin_dir)/bin
74-
CGO_ENABLED=$(CGO_ENABLED) \
75-
$(GO) build \
76-
-ldflags '$(go_$*_ldflags)' \
77-
-o $@ \
78-
$(go_$*_source_path)
79-
80-
.PHONY: $(run_targets)
81-
ARGS ?= # default empty
82-
## Run a controller from your host.
83-
## @category [shared] Build
84-
$(run_targets): run-%: | $(NEEDS_GO)
85-
$(GO) run \
86-
-ldflags '$(go_$*_ldflags)' \
87-
$(go_$*_source_path) $(ARGS)
88-
8969
.PHONY: $(oci_build_targets)
90-
## Build the oci image.
70+
## Build the OCI image.
9171
## @category [shared] Build
9272
$(oci_build_targets): oci-build-%: | $(NEEDS_KO) $(NEEDS_GO) $(NEEDS_YQ) $(bin_dir)/scratch/image
9373
$(eval oci_layout_path := $(bin_dir)/scratch/image/oci-layout-$*.$(oci_$*_image_tag))
9474
rm -rf $(CURDIR)/$(oci_layout_path)
95-
75+
9676
echo '{}' | \
9777
$(YQ) '.defaultBaseImage = "$(oci_$*_base_image)"' | \
9878
$(YQ) '.builds[0].id = "$*"' | \
9979
$(YQ) '.builds[0].main = "$(go_$*_source_path)"' | \
10080
$(YQ) '.builds[0].env[0] = "CGO_ENABLED={{.Env.CGO_ENABLED}}"' | \
81+
$(YQ) '.builds[0].env[1] = "GOEXPERIMENT={{.Env.GOEXPERIMENT}}"' | \
10182
$(YQ) '.builds[0].ldflags[0] = "-s"' | \
10283
$(YQ) '.builds[0].ldflags[1] = "-w"' | \
10384
$(YQ) '.builds[0].ldflags[2] = "{{.Env.LDFLAGS}}"' \
@@ -109,6 +90,7 @@ $(oci_build_targets): oci-build-%: | $(NEEDS_KO) $(NEEDS_GO) $(NEEDS_YQ) $(bin_d
10990
KO_GO_PATH=$(GO) \
11091
LDFLAGS="$(go_$*_ldflags)" \
11192
CGO_ENABLED=$(CGO_ENABLED) \
93+
GOEXPERIMENT=$(GOEXPERIMENT) \
11294
$(KO) build $(go_$*_source_path) \
11395
--platform=$(oci_platforms) \
11496
--oci-layout-path=$(CURDIR)/$(oci_layout_path) \
@@ -122,7 +104,7 @@ $(oci_build_targets): oci-build-%: | $(NEEDS_KO) $(NEEDS_GO) $(NEEDS_YQ) $(bin_d
122104
> $(CURDIR)/$(oci_layout_path).digests
123105

124106
.PHONY: $(oci_push_targets)
125-
## Push docker image.
107+
## Build and push OCI image.
126108
## If the tag already exists, this target will overwrite it.
127109
## If an identical image was already built before, we will add a new tag to it, but we will not sign it again.
128110
## Expected pushed images:
@@ -133,6 +115,7 @@ $(oci_push_targets): oci-push-%: oci-build-% | $(NEEDS_CRANE) $(NEEDS_COSIGN) $(
133115
$(eval oci_layout_path := $(bin_dir)/scratch/image/oci-layout-$*.$(oci_$*_image_tag))
134116
$(eval image_ref := $(shell head -1 $(CURDIR)/$(oci_layout_path).digests))
135117

118+
ifneq ($(RELEASE_DRYRUN),true)
136119
if $(CRANE) image digest $(oci_$*_image_name)@$(image_ref) >/dev/null 2>&1; then \
137120
echo "Digest already exists, will retag without resigning."; \
138121
$(CRANE) push "$(oci_layout_path)" "$(oci_$*_image_name):$(oci_$*_image_tag)"; \
@@ -141,12 +124,10 @@ $(oci_push_targets): oci-push-%: oci-build-% | $(NEEDS_CRANE) $(NEEDS_COSIGN) $(
141124
$(CRANE) push "$(oci_layout_path)" "$(oci_$*_image_name):$(oci_$*_image_tag)"; \
142125
$(COSIGN) sign --yes=true "$(oci_$*_image_name)@$(image_ref)"; \
143126
fi
127+
endif
144128

145129
.PHONY: $(oci_maybe_push_targets)
146-
## Push docker image if tag does not already exist.
147-
## Expected pushed images:
148-
## - :v1.2.3, @sha256:0000001
149-
## - :v1.2.3.sig, :sha256-0000001.sig
130+
## Run 'make oci-push-...' if tag does not already exist in registry.
150131
## @category [shared] Build
151132
$(oci_maybe_push_targets): oci-maybe-push-%: | $(NEEDS_CRANE)
152133
if $(CRANE) manifest digest $(oci_$*_image_name):$(oci_$*_image_tag) > /dev/null 2>&1; then \
@@ -157,7 +138,8 @@ $(oci_maybe_push_targets): oci-maybe-push-%: | $(NEEDS_CRANE)
157138
fi
158139

159140
.PHONY: $(oci_load_targets)
160-
## Load docker image.
141+
## Build OCI image for the local architecture and load
142+
## it into the $(kind_cluster_name) kind cluster.
161143
## @category [shared] Build
162144
$(oci_load_targets): oci_platforms := ""
163145
$(oci_load_targets): oci-load-%: oci-build-% | kind-cluster $(NEEDS_KIND)

0 commit comments

Comments
 (0)