From 0293469f5ff7f7d4feaa53ec392e769f771b5d6b Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sat, 8 Aug 2026 21:50:56 +0200 Subject: [PATCH] Trying to fix CI/CD --- .gitea/workflows/deploy.yml | 22 +++++++--------------- README.md | 8 +++++--- test.sh | 23 ++++++++++++++--------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 56a8621..ce4952a 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -5,6 +5,7 @@ on: pull_request: env: + KUBECONFORM_VERSION: v0.7.0 KUBECTL_VERSION: v1.36.3 KUBERNETES_API: https://host.containers.internal:6443 KUBERNETES_TLS_SERVER_NAME: 192.168.0.2 @@ -18,25 +19,16 @@ jobs: - name: Check out source uses: actions/checkout@v4 - - name: Install kubectl - run: | - curl --fail --silent --show-error --location \ - --output "${RUNNER_TEMP}/kubectl" \ - "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" - curl --fail --silent --show-error --location \ - --output "${RUNNER_TEMP}/kubectl.sha256" \ - "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256" - printf '%s %s\n' "$(cat "${RUNNER_TEMP}/kubectl.sha256")" "${RUNNER_TEMP}/kubectl" | sha256sum --check - chmod 0700 "${RUNNER_TEMP}/kubectl" - - name: Validate scripts and Kubernetes resources run: | sh -n install.sh bash -n create-ci-kubeconfig.sh - "${RUNNER_TEMP}/kubectl" create \ - --dry-run=client \ - --validate=false \ - --filename mumble.yaml >/dev/null + docker run --rm --interactive \ + "ghcr.io/yannh/kubeconform:${KUBECONFORM_VERSION}@sha256:85dbef6b4b312b99133decc9c6fc9495e9fc5f92293d4ff3b7e1b30f5611823c" \ + -strict -summary < mumble.yaml + docker run --rm --interactive \ + "ghcr.io/yannh/kubeconform:${KUBECONFORM_VERSION}@sha256:85dbef6b4b312b99133decc9c6fc9495e9fc5f92293d4ff3b7e1b30f5611823c" \ + -strict -summary < ci-deployer.yaml deploy: name: Deploy to Kubernetes diff --git a/README.md b/README.md index 4ab11e1..c0a39bf 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ configuration is supplied through environment variables. - `mumble.yaml`: LoadBalancer Service and Mumble Deployment. - `install.sh`: administrator installation, credential generation, idempotent PostgreSQL bootstrap, and rollout verification. -- `test.sh`: local syntax and client-side Kubernetes validation. +- `test.sh`: local script and offline Kubernetes schema validation. - `ci-deployer.yaml`: restricted Gitea Actions ServiceAccount, Role, binding, and revocable token request. - `create-ci-kubeconfig.sh`: one-time CI identity bootstrap. @@ -99,8 +99,10 @@ when it starts. Its channels and registrations remain in PostgreSQL. ./test.sh ``` -The test checks both shell scripts and parses the Kubernetes resources without -contacting the cluster. +The test checks both shell scripts and validates the Kubernetes resources with +kubeconform without contacting the cluster. It uses a locally installed +kubeconform binary when available, otherwise the official +`ghcr.io/yannh/kubeconform:v0.7.0` container, pinned by digest, through Docker. ## Automatic deployment with Gitea Actions diff --git a/test.sh b/test.sh index aee7ded..fe96820 100755 --- a/test.sh +++ b/test.sh @@ -4,16 +4,21 @@ set -euo pipefail project_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) -command -v kubectl >/dev/null 2>&1 || { - echo "Required command not found: kubectl" >&2 - exit 1 -} - sh -n "${project_dir}/install.sh" bash -n "${project_dir}/create-ci-kubeconfig.sh" -kubectl create \ - --dry-run=client \ - --validate=false \ - --filename "${project_dir}/mumble.yaml" >/dev/null + +if command -v kubeconform >/dev/null 2>&1; then + kubeconform -strict -summary "${project_dir}/mumble.yaml" "${project_dir}/ci-deployer.yaml" +elif command -v docker >/dev/null 2>&1; then + docker run --rm --interactive \ + ghcr.io/yannh/kubeconform:v0.7.0@sha256:85dbef6b4b312b99133decc9c6fc9495e9fc5f92293d4ff3b7e1b30f5611823c \ + -strict -summary < "${project_dir}/mumble.yaml" + docker run --rm --interactive \ + ghcr.io/yannh/kubeconform:v0.7.0@sha256:85dbef6b4b312b99133decc9c6fc9495e9fc5f92293d4ff3b7e1b30f5611823c \ + -strict -summary < "${project_dir}/ci-deployer.yaml" +else + echo "Required command not found: install kubeconform or Docker" >&2 + exit 1 +fi echo "Mumble scripts and Kubernetes resources are valid."