From cc4405f7886ca7194924ff18cd490aff1c1fefde Mon Sep 17 00:00:00 2001 From: panxiao81 Date: Mon, 21 Sep 2026 11:05:03 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20=E4=BF=9D=E7=95=99=20kind=20=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=8E=B0=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/vm-kind-smoke.yml | 46 ++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/vm-kind-smoke.yml b/.gitea/workflows/vm-kind-smoke.yml index f2a5b20..1d683fe 100644 --- a/.gitea/workflows/vm-kind-smoke.yml +++ b/.gitea/workflows/vm-kind-smoke.yml @@ -1,5 +1,7 @@ +--- name: VM kind smoke +# yamllint disable-line rule:truthy on: workflow_dispatch: @@ -15,17 +17,51 @@ jobs: run: | set -euo pipefail version=v0.33.0 + base_url="https://kind.sigs.k8s.io/dl/${version}" curl --fail --location --silent --show-error \ - --output /tmp/kind "https://kind.sigs.k8s.io/dl/${version}/kind-linux-amd64" + --output /tmp/kind "${base_url}/kind-linux-amd64" curl --fail --location --silent --show-error \ - --output /tmp/kind.sha256sum "https://kind.sigs.k8s.io/dl/${version}/kind-linux-amd64.sha256sum" - printf '%s %s\n' "$(cut -d ' ' -f1 /tmp/kind.sha256sum)" /tmp/kind | sha256sum --check + --output /tmp/kind.sha256sum \ + "${base_url}/kind-linux-amd64.sha256sum" + checksum=$(cut -d ' ' -f1 /tmp/kind.sha256sum) + printf '%s %s\n' "$checksum" /tmp/kind | sha256sum --check chmod 0755 /tmp/kind - name: Create and delete kind cluster shell: bash run: | set -euo pipefail - trap '/tmp/kind delete cluster --name smoke' EXIT - /tmp/kind create cluster --name smoke --wait 180s + diagnose_and_cleanup() { + status=$? + node=smoke-control-plane + if (( status != 0 )) && docker inspect "$node" >/dev/null 2>&1; then + echo '::group::kind node inspect' + docker inspect "$node" + echo '::endgroup::' + echo '::group::kind node logs' + docker logs "$node" 2>&1 || true + echo '::endgroup::' + echo '::group::kind node guest state' + docker exec "$node" bash -c ' + set +e + echo "### pid 1" + ps -p 1 -o pid,ppid,user,stat,comm,args + cat /proc/1/status + echo "### cgroup" + cat /proc/1/cgroup + findmnt -R /sys/fs/cgroup + stat -fc "%T %a" /sys/fs/cgroup + echo "### systemd" + systemctl --no-pager --failed + systemctl --no-pager status \ + multi-user.target containerd.service kubelet.service + journalctl --no-pager -b -n 500 + ' 2>&1 || true + echo '::endgroup::' + fi + /tmp/kind delete cluster --name smoke || true + exit "$status" + } + trap diagnose_and_cleanup EXIT + /tmp/kind create cluster --name smoke --wait 180s --retain /tmp/kind get clusters | grep -Fx smoke