Skip to content

Commit

Permalink
Merge pull request #505 from cert-manager/self-upgrade-main
Browse files Browse the repository at this point in the history
[CI] Merge self-upgrade-main into main
  • Loading branch information
cert-manager-prow[bot] authored Dec 11, 2024
2 parents 5644c79 + 171fbd0 commit 9b27feb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
26 changes: 13 additions & 13 deletions klone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,65 +10,65 @@ targets:
- folder_name: boilerplate
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/boilerplate
- folder_name: cert-manager
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/cert-manager
- folder_name: controller-gen
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/controller-gen
- folder_name: generate-verify
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/generate-verify
- folder_name: go
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/go
- folder_name: helm
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/helm
- folder_name: help
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/help
- folder_name: kind
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/kind
- folder_name: klone
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/klone
- folder_name: oci-build
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/oci-build
- folder_name: oci-publish
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/oci-publish
- folder_name: repository-base
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/repository-base
- folder_name: tools
repo_url: https://github.com/cert-manager/makefile-modules.git
repo_ref: main
repo_hash: 6eccdeac5eab23905699243209e0f81afad6f081
repo_hash: 25ec11345ab139986fad5fe7ffb5503069e6f81b
repo_path: modules/tools
27 changes: 15 additions & 12 deletions make/_shared/helm/crds.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,35 @@ endif
crds_dir ?= deploy/crds
crds_dir_readme := $(dir $(lastword $(MAKEFILE_LIST)))/crds_dir.README.md

$(crds_dir):
mkdir -p $@

$(crds_dir)/README.md: $(crds_dir_readme) | $(crds_dir)
cp $< $@

.PHONY: generate-crds
## Generate CRD manifests.
## @category [shared] Generate/ Verify
generate-crds: | $(crds_dir)/README.md $(NEEDS_CONTROLLER-GEN) $(NEEDS_YQ)
generate-crds: | $(NEEDS_CONTROLLER-GEN) $(NEEDS_YQ)
$(eval crds_gen_temp := $(bin_dir)/scratch/crds)
$(eval directories := $(shell ls -d */ | grep -v -e 'make' $(shell git check-ignore -- * | sed 's/^/-e /')))

rm -rf $(crds_gen_temp)
mkdir -p $(crds_gen_temp)

$(CONTROLLER-GEN) crd \
$(directories:%=paths=./%...) \
output:crd:artifacts:config=$(crds_dir)
output:crd:artifacts:config=$(crds_gen_temp)

echo "Updating CRDs with helm templating, writing to $(helm_chart_source_dir)/templates"
@echo "Updating CRDs with helm templating, writing to $(helm_chart_source_dir)/templates"

@for i in $$(basename $(crds_dir)/*.yaml); do \
crd_name=$$($(YQ) eval '.metadata.name' $(crds_dir)/$$i); \
@for i in $$(ls $(crds_gen_temp)); do \
crd_name=$$($(YQ) eval '.metadata.name' $(crds_gen_temp)/$$i); \
cat $(crd_template_header) > $(helm_chart_source_dir)/templates/crd-$$i; \
echo "" >> $(helm_chart_source_dir)/templates/crd-$$i; \
$(sed_inplace) "s/REPLACE_CRD_NAME/$$crd_name/g" $(helm_chart_source_dir)/templates/crd-$$i; \
$(sed_inplace) "s/REPLACE_LABELS_TEMPLATE/$(helm_labels_template_name)/g" $(helm_chart_source_dir)/templates/crd-$$i; \
$(YQ) -I2 '{"spec": .spec}' $(crds_dir)/$$i >> $(helm_chart_source_dir)/templates/crd-$$i; \
$(YQ) -I2 '{"spec": .spec}' $(crds_gen_temp)/$$i >> $(helm_chart_source_dir)/templates/crd-$$i; \
cat $(crd_template_footer) >> $(helm_chart_source_dir)/templates/crd-$$i; \
done

@if [ -n "$$(ls $(crds_gen_temp) 2>/dev/null)" ]; then \
cp -Tr $(crds_gen_temp) $(crds_dir); \
cp $(crds_dir_readme) $(crds_dir)/README.md; \
fi

shared_generate_targets += generate-crds

0 comments on commit 9b27feb

Please sign in to comment.