Skip to content

Commit 8c5b630

Browse files
committed
feat: enhance CRD packaging in Makefile to support both yq and manual concatenation methods
1 parent 7f915b4 commit 8c5b630

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,25 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
101101
.PHONY: package-crds
102102
package-crds: manifests ## Package CRDs into a single YAML file
103103
mkdir -p dist
104-
cat config/crd/bases/*.yaml > dist/ui-operator-crds-$(VERSION).yaml
104+
@echo "# UI Operator CRDs - Version $(VERSION)" > dist/ui-operator-crds-$(VERSION).yaml
105+
@echo "# Generated on $$(date)" >> dist/ui-operator-crds-$(VERSION).yaml
106+
@if command -v yq >/dev/null 2>&1; then \
107+
echo "Using yq to merge YAML files..."; \
108+
yq eval-all 'select(. != null)' config/crd/bases/*.yaml >> dist/ui-operator-crds-$(VERSION).yaml; \
109+
else \
110+
echo "Using manual YAML concatenation with proper separators..."; \
111+
first=true; \
112+
for file in config/crd/bases/*.yaml; do \
113+
if [ "$$first" = true ]; then \
114+
first=false; \
115+
else \
116+
echo "---" >> dist/ui-operator-crds-$(VERSION).yaml; \
117+
fi; \
118+
echo "# Source: $$(basename $$file)" >> dist/ui-operator-crds-$(VERSION).yaml; \
119+
cat $$file >> dist/ui-operator-crds-$(VERSION).yaml; \
120+
echo "" >> dist/ui-operator-crds-$(VERSION).yaml; \
121+
done; \
122+
fi
105123

106124
.PHONY: generate
107125
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.

0 commit comments

Comments
 (0)