@@ -198,3 +198,157 @@ jobs:
198198 export CHART_VERSION=$(grep 'version:' charts/$chart/Chart.yaml | head -n1 | awk '{ print $2 }')
199199 helm push $chart-${CHART_VERSION}.tgz oci://${HELM_REGISTRY}
200200 done
201+
202+ kubeconform :
203+ name : kubeconform-check
204+ runs-on : ubuntu-latest
205+ needs :
206+ - publish-ghcr-scroll-sdk
207+ steps :
208+ - name : Checkout
209+ uses : actions/checkout@v3
210+ with :
211+ fetch-depth : 0
212+ - uses : dorny/paths-filter@v2
213+ id : filter
214+ with :
215+ base : ${{ github.event.repository.default_branch }}
216+ list-files : shell
217+ filters : |
218+ addedOrModified:
219+ - added|modified: 'charts/scroll-sdk/**'
220+
221+ - name : Helm registry login
222+ run : |
223+ helm registry login ghcr.io/scroll-tech/helm/scroll-sdk --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
224+
225+ - name : Replace helm registry by helm/dev
226+ run : |
227+ find charts/ -type f -exec sed -i 's|oci://ghcr.io/scroll-tech/scroll-sdk/helm|oci://ghcr.io/scroll-tech/scroll-sdk/helm/dev|g' {} +
228+
229+ - name : Install Kubeconform
230+ run : |
231+ set -e
232+ wget https://github.com/yannh/kubeconform/releases/download/v0.6.7/kubeconform-linux-amd64.tar.gz
233+ tar xf kubeconform-linux-amd64.tar.gz
234+ sudo mv kubeconform /usr/local/bin/
235+
236+ - name : Add Helm repositories
237+ run : |
238+ helm repo add grafana https://grafana.github.io/helm-charts
239+ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
240+ helm repo add blockscout https://blockscout.github.io/helm-charts
241+ helm repo update
242+
243+ - name : Validate rendered templates
244+ run : |
245+ set -e
246+ failed_charts=()
247+ for chart in charts/*; do
248+ if [ -d "$chart" ]; then
249+ echo "Processing chart $chart"
250+ if [[ $(basename $chart) == "common" ]] || [[ $(basename $chart) == "external-secrets-lib" ]]; then
251+ echo "Skipping library chart: $chart"
252+ continue
253+ fi
254+
255+ if ! helm dependency update $chart; then
256+ failed_charts+=("$chart - dependency update failed")
257+ continue
258+ fi
259+
260+ if ! helm dependency build $chart; then
261+ failed_charts+=("$chart - dependency build failed")
262+ continue
263+ fi
264+
265+ if ! helm template $(basename $chart) $chart | kubeconform \
266+ -summary \
267+ -output json \
268+ -schema-location default \
269+ -schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/servicemonitors-crd.json \
270+ -schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/alertmanagers-crd.json \
271+ -schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/prometheusrules-crd.json \
272+ -schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/prometheuses-crd.json \
273+ -schema-location https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/jsonnet/prometheus-operator/podmonitors-crd.json \
274+ -strict \
275+ -; then
276+ failed_charts+=("$chart - validation failed")
277+ fi
278+ fi
279+ done
280+
281+ if [ ${#failed_charts[@]} -ne 0 ]; then
282+ echo "faild charts are:"
283+ printf '%s\n' "${failed_charts[@]}"
284+ exit 1
285+ fi
286+
287+ run-k8s-test :
288+ name : check-services-up-and-running
289+ runs-on : ubuntu-latest
290+ needs :
291+ - publish-ghcr-scroll-sdk
292+ steps :
293+ - name : Checkout
294+ uses : actions/checkout@v3
295+ with :
296+ fetch-depth : 0
297+
298+ - name : Set up Helm
299+ uses : azure/setup-helm@v3
300+ with :
301+ version : v3.12.1
302+
303+ - uses : actions/setup-python@v5
304+ with :
305+ python-version : ' 3.x'
306+ check-latest : true
307+
308+ - name : Set up chart-testing
309+ 310+
311+ - name : Replace helm registry by helm/dev
312+ run : |
313+ find devnet/ -type f -exec sed -i 's|oci://ghcr.io/scroll-tech/scroll-sdk/helm|oci://ghcr.io/scroll-tech/scroll-sdk/helm/dev|g' {} +
314+
315+ - name : Create Kind Cluster
316+ 317+ with :
318+ cluster_name : chart-testing
319+
320+ - name : Helm registry login
321+ run : |
322+ helm registry login ghcr.io/scroll-tech/helm/scroll-sdk --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }}
323+
324+ - name : Run Devnet Bootstrap
325+ run : cd devnet && make bootstrap
326+
327+ - name : Install Charts using Makefile
328+ run : |
329+ cd devnet
330+ make install
331+
332+ - name : Ensure all services are up and running
333+ run : |
334+ START_TIME=$(date +%s)
335+ TIMEOUT=600
336+
337+ while true; do
338+ ELAPSED_TIME=$(( $(date +%s) - START_TIME ))
339+
340+ if [ "$ELAPSED_TIME" -ge "$TIMEOUT" ]; then
341+ echo "Timeout reached: Exiting after $TIMEOUT seconds"
342+ exit 1
343+ fi
344+ kubectl get pods
345+ kubectl describe nodes
346+
347+ if kubectl wait --for=condition=Ready pod --all --field-selector=status.phase!=Succeeded,status.phase!=Failed --timeout=5s; then
348+ echo "All pods are ready."
349+ break
350+ else
351+ echo "Waiting for pods to be ready..."
352+ sleep 10
353+ fi
354+ done
0 commit comments