Skip to content

Commit

Permalink
Merge pull request #69 from cert-manager/self-upgrade
Browse files Browse the repository at this point in the history
[CI] Merge self-upgrade into main
  • Loading branch information
jetstack-bot authored Jan 18, 2024
2 parents 6f7bc57 + bc1a56e commit a4c3815
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 44 deletions.
22 changes: 11 additions & 11 deletions klone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,55 @@ targets:
- folder_name: boilerplate
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/boilerplate
- folder_name: cert-manager
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/cert-manager
- folder_name: controller-gen
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/controller-gen
- folder_name: generate-verify
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/generate-verify
- folder_name: helm
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/helm
- folder_name: help
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/help
- folder_name: kind
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/kind
- folder_name: klone
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/klone
- folder_name: oci-image
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/oci-image
- folder_name: repository-base
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/repository-base
- folder_name: tools
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 4a22c2c49479bece6df1fd54695c6bbe07fa33da
repo_hash: c4dba5d8d7d65efbd1b232e81d7c95996c6989fb
repo_path: modules/tools
7 changes: 1 addition & 6 deletions make/_shared/generate-verify/00_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Shared targets are set by other Makefile modules.
shared_generate_targets ?=
shared_verify_targets ?=
shared_verify_targets_dirty ?=

# Extra targets are set by the Makefiles in the project.
extra_generate_targets ?=
extra_verify_targets ?=
extra_verify_targets_dirty ?=
6 changes: 3 additions & 3 deletions make/_shared/generate-verify/02_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.PHONY: generate
## Generate all generate targets.
## @category [shared] Generate/ Verify
generate: $(shared_generate_targets) $(extra_generate_targets)
generate: $(shared_generate_targets)

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

Expand All @@ -26,6 +26,6 @@ verify-%: FORCE
.PHONY: verify
## Verify code and generate targets.
## @category [shared] Generate/ Verify
verify: $(shared_generate_targets:%=verify-%) $(extra_generate_targets:%=verify-%) $(shared_verify_targets) $(extra_verify_targets)
verify: $(shared_generate_targets:%=verify-%) $(shared_verify_targets)
@echo "The following targets create temporary files in the current directory, that is why they have to be run last:"
$(MAKE) noop $(shared_verify_targets_dirty) $(extra_verify_targets_dirty)
$(MAKE) noop $(shared_verify_targets_dirty)
13 changes: 10 additions & 3 deletions make/_shared/kind/00_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@
images_amd64 ?=
images_arm64 ?=

kind_version := v1.27.3
kind_k8s_version := v1.29.0

images_amd64 += docker.io/kindest/node:$(kind_version)@sha256:9dd3392d79af1b084671b05bcf65b21de476256ad1dcc853d9f3b10b4ac52dde
images_arm64 += docker.io/kindest/node:$(kind_version)@sha256:de0b3dfe848ccf07e24f4278eaf93edb857b6231b39773f46b36a2b1a6543ae9
# Goto https://github.com/kubernetes-sigs/kind/releases/tag/<KIND-VERSION> and find the
# multi-arch digest for the image you want to use. Then use crane to get the platform
# specific digest. For example (digest is the multi-arch digest from the release page):
# digest="sha256:eaa1450915475849a73a9227b8f201df25e55e268e5d619312131292e324d570"
# crane digest --platform=linux/amd64 docker.io/kindest/node@$digest
# crane digest --platform=linux/arm64 docker.io/kindest/node@$digest

images_amd64 += docker.io/kindest/node:$(kind_k8s_version)@sha256:54a50c9354f11ce0aa56a85d2cacb1b950f85eab3fe1caf988826d1f89bf37eb
images_arm64 += docker.io/kindest/node:$(kind_k8s_version)@sha256:8ccbd8bc4d52c467f3c79eeeb434827c225600a1d7385a4b1c19d9e038c9e0c0
5 changes: 3 additions & 2 deletions make/_shared/oci-image/01_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

oci_platforms := all
oci_platforms := linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down Expand Up @@ -82,6 +82,7 @@ ARGS ?= # default empty
## Run a controller from your host.
## @category [shared] Build
$(run_targets): run-%: | $(NEEDS_GO)
CGO_ENABLED=$(CGO_ENABLED) \
$(GO) run \
-ldflags '$(go_$*_ldflags)' \
$(go_$*_source_path) $(ARGS)
Expand All @@ -92,7 +93,7 @@ $(run_targets): run-%: | $(NEEDS_GO)
$(oci_build_targets): oci-build-%: | $(NEEDS_KO) $(NEEDS_GO) $(NEEDS_YQ) $(bin_dir)/scratch/image
$(eval oci_layout_path := $(bin_dir)/scratch/image/oci-layout-$*.$(oci_$*_image_tag))
rm -rf $(CURDIR)/$(oci_layout_path)

echo '{}' | \
$(YQ) '.defaultBaseImage = "$(oci_$*_base_image)"' | \
$(YQ) '.builds[0].id = "$*"' | \
Expand Down
28 changes: 9 additions & 19 deletions make/_shared/tools/00_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ TOOLS += syft=v0.100.0

# https://pkg.go.dev/k8s.io/code-generator/cmd?tab=versions
K8S_CODEGEN_VERSION=v0.29.0
TOOLS += applyconfiguration-gen=$(K8S_CODEGEN_VERSION)
TOOLS += openapi-gen=$(K8S_CODEGEN_VERSION)
TOOLS += defaulter-gen=$(K8S_CODEGEN_VERSION)
TOOLS += conversion-gen=$(K8S_CODEGEN_VERSION)

# https://github.com/kubernetes-sigs/kubebuilder/blob/tools-releases/build/cloudbuild_tools.yaml
KUBEBUILDER_ASSETS_VERSION=1.28.3
Expand Down Expand Up @@ -268,6 +272,10 @@ GO_DEPENDENCIES += oras=oras.land/oras/cmd/oras
GO_DEPENDENCIES += klone=github.com/cert-manager/klone
GO_DEPENDENCIES += goreleaser=github.com/goreleaser/goreleaser
GO_DEPENDENCIES += syft=github.com/anchore/syft/cmd/syft
GO_DEPENDENCIES += applyconfiguration-gen=k8s.io/code-generator/cmd/applyconfiguration-gen
GO_DEPENDENCIES += openapi-gen=k8s.io/code-generator/cmd/openapi-gen
GO_DEPENDENCIES += defaulter-gen=k8s.io/code-generator/cmd/defaulter-gen
GO_DEPENDENCIES += conversion-gen=k8s.io/code-generator/cmd/conversion-gen

define go_dependency
$$(bin_dir)/downloaded/tools/$1@$($(call UC,$1)_VERSION)_%: | $$(NEEDS_GO) $$(bin_dir)/downloaded/tools
Expand Down Expand Up @@ -349,24 +357,6 @@ $(bin_dir)/downloaded/tools/azwi@$(AZWI_VERSION)_%: | $(bin_dir)/downloaded/tool
tar xfO $@.tar.gz azwi > $@ && chmod 775 $@
rm -f $@.tar.gz

#####################
# k8s codegen tools #
#####################

K8S_CODEGEN_TOOLS := applyconfiguration-gen openapi-gen
K8S_CODEGEN_TOOLS_PATHS := $(K8S_CODEGEN_TOOLS:%=$(bin_dir)/tools/%)
K8S_CODEGEN_TOOLS_DOWNLOADS := $(K8S_CODEGEN_TOOLS:%=$(bin_dir)/downloaded/tools/%@$(K8S_CODEGEN_VERSION))

k8s-codegen-tools: $(K8S_CODEGEN_TOOLS_PATHS)

$(K8S_CODEGEN_TOOLS_PATHS): $(bin_dir)/tools/%-gen: $(bin_dir)/scratch/K8S_CODEGEN_VERSION | $(bin_dir)/downloaded/tools/%-gen@$(K8S_CODEGEN_VERSION) $(bin_dir)/tools
cd $(dir $@) && $(LN) $(patsubst $(bin_dir)/%,../%,$(word 1,$|)) $(notdir $@)
@touch $@ # making sure the target of the symlink is newer than *_VERSION

$(K8S_CODEGEN_TOOLS_DOWNLOADS): $(bin_dir)/downloaded/tools/%-gen@$(K8S_CODEGEN_VERSION): $(NEEDS_GO) | $(bin_dir)/downloaded/tools
GOBIN=$(CURDIR)/$(dir $@) $(GO) install k8s.io/code-generator/cmd/$(notdir $@)
@mv $(subst @$(K8S_CODEGEN_VERSION),,$@) $@

############################
# kubebuilder-tools assets #
# kube-apiserver / etcd #
Expand Down Expand Up @@ -474,7 +464,7 @@ endif
.PHONY: tools
## Download and setup all tools
## @category [shared] Tools
tools: $(TOOLS_PATHS) $(K8S_CODEGEN_TOOLS_PATHS)
tools: $(TOOLS_PATHS)

self_file := $(dir $(lastword $(MAKEFILE_LIST)))/00_mod.mk

Expand Down

0 comments on commit a4c3815

Please sign in to comment.