diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index cf1c4f3a..e68b944a 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -11,27 +11,32 @@ jobs: runs-on: ubuntu-latest container: - image: docker/tilt:latest + image: tiltdev/tilt:latest steps: - uses: actions/checkout@v6 - - uses: azure/setup-helm@v5.0.1 - - - name: Create k8s Kind Cluster - run: ctlptl create cluster kind --registry=ctlptl-registry - - - name: Cache Helm Output + - name: Cache Helm and Registry id: cache-helm-output uses: actions/cache@v5 with: - path: .helm-cache + path: | + .helm-cache + ${{ env.GITHUB_WORKSPACE }}/.registry key: ${{ github.ref_name }}-${{ hashFiles('apps/**/*.yaml', 'cluster/traefik/**/*.yaml', 'cluster/storage/**/*.yaml', 'infra/**/*.yaml', 'ops/monitoring/**/*.yaml') }} restore-keys: | ${{ github.ref_name }} develop ${{ github.base_ref }} + - uses: azure/setup-helm@v5.0.1 + + - name: Create Registry + run: docker run -d -p "127.0.0.1:5000:5000" --network bridge --name kind-registry --env REGISTRY_STORAGE_DELETE_ENABLED=true -v $GITHUB_WORKSPACE/.registry:/var/lib/registry registry:3 + + - name: Create k8s Kind Cluster + run: ctlptl apply -f tilt/ctlptl.yaml + - name: Test Using Local Config run: tilt ci --timeout "5m" diff --git a/Tiltfile b/Tiltfile index cddea5a6..881fae8e 100644 --- a/Tiltfile +++ b/Tiltfile @@ -267,7 +267,7 @@ for object in decode_yaml_stream(traefik_yaml): traefik_crds.append(name + ":" + kind) k8s_resource(new_name="traefik-crds", objects=traefik_crds, labels=["traefik"]) -agnostic_local_resource("wait-for-traefik-crd", cmd=["kubectl", "wait", "--for=condition=established", "--timeout=60s", "crd/ingressroutes.traefik.io"], resource_deps=["traefik-crds"], labels=["traefik"]) +agnostic_local_resource("wait-for-traefik-crd", cmd=["./tilt/scripts/wait-for.sh", "--for=condition=established", "--timeout=60s", "crd/ingressroutes.traefik.io"], resource_deps=["traefik-crds"], labels=["traefik"]) k8s_resource(new_name="traefik-setup", objects=traefik_identifiers, resource_deps=["namespaces", "wait-for-traefik-crd"], labels=["traefik"]) k8s_resource(workload="traefik", port_forwards=["443:8443", "80:8000"], resource_deps=["traefik-setup"], labels=["traefik"], links=[link("http://traefik.{}".format(base_domain), "FAF Traefik")]) @@ -295,7 +295,7 @@ k8s_resource(new_name="monitoring-setup", objects=monitoring_accounts + monitori k8s_resource(workload="monitoring-grafana", objects=["grafana:ingressroute"], resource_deps=["monitoring-setup"], labels=["monitoring"], links=[link("http://grafana.{}".format(base_domain), "FAF Grafana")]) k8s_resource(workload="monitoring-kube-state-metrics", resource_deps=["monitoring-setup"], labels=["monitoring"]) k8s_resource(workload="monitoring-loki", resource_deps=["monitoring-setup"], labels=["monitoring"]) -agnostic_local_resource("wait-for-alloy-crd", cmd=["kubectl", "wait", "--for=condition=established", "--timeout=60s", "crd/alloys.collectors.grafana.com"], resource_deps=["monitoring-crds"], labels=["monitoring"]) +agnostic_local_resource("wait-for-alloy-crd", cmd=["./tilt/scripts/wait-for.sh", "--for=condition=established", "--timeout=60s", "crd/alloys.collectors.grafana.com"], resource_deps=["monitoring-crds"], labels=["monitoring"]) k8s_resource(new_name="monitoring-alloy-logs", objects=["monitoring-alloy-logs:alloy"], resource_deps=["monitoring-setup", "wait-for-alloy-crd"], labels=["monitoring"]) k8s_resource(workload="monitoring-loki-gateway", resource_deps=["monitoring-setup"], labels=["monitoring"]) k8s_resource(workload="monitoring-loki-results-cache", resource_deps=["monitoring-setup"], labels=["monitoring"]) diff --git a/tilt/ctlptl.yaml b/tilt/ctlptl.yaml new file mode 100644 index 00000000..91c65d2f --- /dev/null +++ b/tilt/ctlptl.yaml @@ -0,0 +1,9 @@ +apiVersion: ctlptl.dev/v1alpha1 +kind: Registry +name: kind-registry +port: 5000 +--- +apiVersion: ctlptl.dev/v1alpha1 +kind: Cluster +product: kind +registry: kind-registry \ No newline at end of file diff --git a/tilt/scripts/wait-for.sh b/tilt/scripts/wait-for.sh new file mode 100755 index 00000000..728e4d68 --- /dev/null +++ b/tilt/scripts/wait-for.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +until kubectl wait "$@" 2>/dev/null; do + echo "Waiting for resources to be created and ready..." + sleep 2 +done \ No newline at end of file