Skip to content

Commit

Permalink
Merge pull request #79 from embik/validate-resources
Browse files Browse the repository at this point in the history
✨ Add hack/ci/render-helm-charts.sh that improves validation
  • Loading branch information
kcp-ci-bot authored Jan 5, 2024
2 parents 3408f59 + 7be42e1 commit 5889557
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.kubeconfig

# output of hack/ci/validate-helm-resources.sh
kcp-templated.yaml
10 changes: 2 additions & 8 deletions .prow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ presubmits:
clone_uri: "https://github.com/kcp-dev/helm-charts"
spec:
containers:
- image: ghcr.io/kcp-dev/infra/build:1.20.8-1
- image: ghcr.io/kcp-dev/infra/build:1.20.9-3
command:
- helm
args:
- template
- --debug
- --set=externalHostname=ci.kcp.io
- kcp
- charts/kcp/
- hack/ci/render-helm-charts.sh
resources:
requests:
memory: 64Mi
Expand Down
32 changes: 32 additions & 0 deletions hack/ci/render-helm-charts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "$0")/../.."

if ! [ -x "$(command -v helm)" ]; then
echo "missing helm command in PATH"
exit 1
fi

if ! [ -x "$(command -v kubeconform)" ]; then
echo "missing kubeconform command in PATH"
exit 1
fi

helm template \
--debug \
--set=externalHostname=ci.kcp.io \
kcp charts/kcp/ | tee kcp-templated.yaml

echo "---"

# run kubeconform on template output to validate Kubernetes resources.
# the external schema-location allows us to validate resources for
# common CRDs (e.g. cert-manager resources).
kubeconform \
-schema-location default \
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \
-strict \
-summary \
kcp-templated.yaml

0 comments on commit 5889557

Please sign in to comment.