diff --git a/.gitea/workflows/render-manifests-automerge.yaml b/.gitea/workflows/render-manifests-automerge.yaml index c50515af5..0fa85156d 100644 --- a/.gitea/workflows/render-manifests-automerge.yaml +++ b/.gitea/workflows/render-manifests-automerge.yaml @@ -153,8 +153,10 @@ jobs: echo ">> Chart path $chart_path" if [ -f "$chart_path/Chart.yaml" ]; then - mkdir -p ${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name OUTPUT_FOLDER="${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name/" + TEMPLATE="" + + mkdir -p ${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name cd $chart_path @@ -168,40 +170,28 @@ jobs: echo "" echo ">> Rendering templates ..." - case "$chart_name" in "stack") echo "" - echo ">> Special Rendering for stack ..." - helm template stack ./ --namespace argocd --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo ">> Special Rendering for stack into argocd namespace ..." + TEMPLATE=$(helm template $chart_name ./ --namespace argocd --include-crds --dry-run) ;; - "cilium") + "cilium" | "coredns" | "metrics-server" |"prometheus-operator-crds") echo "" - echo ">> Special Rendering for cilium ..." - helm template cilium ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "coredns") - echo "" - echo ">> Special Rendering for coredns ..." - helm template coredns ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "metrics-server") - echo "" - echo ">> Special Rendering for metrics-server ..." - helm template metrics-server ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "prometheus-operator-crds") - echo "" - echo ">> Special Rendering for prometheus-operator-crds ..." - helm template prometheus-operator-crds ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo ">> Special Rendering for $chart_name into kube-system namespace ..." + TEMPLATE=$(helm template $chart_name ./ --namespace kube-system --include-crds --dry-run) ;; *) echo "" echo ">> Standard Rendering for $chart_name ..." - helm template "$chart_name" ./ --namespace "$chart_name" --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + TEMPLATE=$(helm template "$chart_name" ./ --namespace "$chart_name" --include-crds --dry-run) ;; esac + echo "" + echo ">> Formating rendered template ..." + echo "$TEMPLATE" | yq 'select(. != null)' | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo "" echo ">> Manifests for $chart_name rendered to $OUTPUT_FOLDER" ls $OUTPUT_FOLDER diff --git a/.gitea/workflows/render-manifests-merge.yaml b/.gitea/workflows/render-manifests-merge.yaml index 1a72294cf..b5ad84c2e 100644 --- a/.gitea/workflows/render-manifests-merge.yaml +++ b/.gitea/workflows/render-manifests-merge.yaml @@ -158,8 +158,10 @@ jobs: echo ">> Chart path $chart_path" if [ -f "$chart_path/Chart.yaml" ]; then - mkdir -p ${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name OUTPUT_FOLDER="${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name/" + TEMPLATE="" + + mkdir -p ${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name cd $chart_path @@ -173,40 +175,28 @@ jobs: echo "" echo ">> Rendering templates ..." - case "$chart_name" in "stack") echo "" - echo ">> Special Rendering for stack ..." - helm template stack ./ --namespace argocd --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo ">> Special Rendering for stack into argocd namespace ..." + TEMPLATE=$(helm template $chart_name ./ --namespace argocd --include-crds --dry-run) ;; - "cilium") + "cilium" | "coredns" | "metrics-server" |"prometheus-operator-crds") echo "" - echo ">> Special Rendering for cilium ..." - helm template cilium ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "coredns") - echo "" - echo ">> Special Rendering for coredns ..." - helm template coredns ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "metrics-server") - echo "" - echo ">> Special Rendering for metrics-server ..." - helm template metrics-server ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "prometheus-operator-crds") - echo "" - echo ">> Special Rendering for prometheus-operator-crds ..." - helm template prometheus-operator-crds ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo ">> Special Rendering for $chart_name into kube-system namespace ..." + TEMPLATE=$(helm template $chart_name ./ --namespace kube-system --include-crds --dry-run) ;; *) echo "" echo ">> Standard Rendering for $chart_name ..." - helm template "$chart_name" ./ --namespace "$chart_name" --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + TEMPLATE=$(helm template "$chart_name" ./ --namespace "$chart_name" --include-crds --dry-run) ;; esac + echo "" + echo ">> Formating rendered template ..." + echo "$TEMPLATE" | yq 'select(. != null)' | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo "" echo ">> Manifests for $chart_name rendered to $OUTPUT_FOLDER" ls $OUTPUT_FOLDER diff --git a/.gitea/workflows/render-manifests-push.yaml b/.gitea/workflows/render-manifests-push.yaml index d3f7de15b..d86d4fdff 100644 --- a/.gitea/workflows/render-manifests-push.yaml +++ b/.gitea/workflows/render-manifests-push.yaml @@ -156,8 +156,10 @@ jobs: echo ">> Chart path $chart_path" if [ -f "$chart_path/Chart.yaml" ]; then - mkdir -p ${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name OUTPUT_FOLDER="${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name/" + TEMPLATE="" + + mkdir -p ${MANIFEST_DIR}/clusters/${CLUSTER}/manifests/$chart_name cd $chart_path @@ -171,40 +173,28 @@ jobs: echo "" echo ">> Rendering templates ..." - case "$chart_name" in "stack") echo "" - echo ">> Special Rendering for stack ..." - helm template stack ./ --namespace argocd --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo ">> Special Rendering for stack into argocd namespace ..." + TEMPLATE=$(helm template $chart_name ./ --namespace argocd --include-crds --dry-run) ;; - "cilium") + "cilium" | "coredns" | "metrics-server" |"prometheus-operator-crds") echo "" - echo ">> Special Rendering for cilium ..." - helm template cilium ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "coredns") - echo "" - echo ">> Special Rendering for coredns ..." - helm template coredns ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "metrics-server") - echo "" - echo ">> Special Rendering for metrics-server ..." - helm template metrics-server ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' - ;; - "prometheus-operator-crds") - echo "" - echo ">> Special Rendering for prometheus-operator-crds ..." - helm template prometheus-operator-crds ./ --namespace kube-system --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo ">> Special Rendering for $chart_name into kube-system namespace ..." + TEMPLATE=$(helm template $chart_name ./ --namespace kube-system --include-crds --dry-run) ;; *) echo "" echo ">> Standard Rendering for $chart_name ..." - helm template "$chart_name" ./ --namespace "$chart_name" --include-crds --dry-run | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + TEMPLATE=$(helm template "$chart_name" ./ --namespace "$chart_name" --include-crds --dry-run) ;; esac + echo "" + echo ">> Formating rendered template ..." + echo "$TEMPLATE" | yq 'select(. != null)' | yq -s '"'"$OUTPUT_FOLDER"'" + .kind + "-" + .metadata.name + ".yaml"' + echo "" echo ">> Manifests for $chart_name rendered to $OUTPUT_FOLDER" ls $OUTPUT_FOLDER