ci: 保留 kind 失败现场
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
|
---
|
||||||
name: VM kind smoke
|
name: VM kind smoke
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@@ -15,17 +17,51 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
version=v0.33.0
|
version=v0.33.0
|
||||||
|
base_url="https://kind.sigs.k8s.io/dl/${version}"
|
||||||
curl --fail --location --silent --show-error \
|
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 \
|
curl --fail --location --silent --show-error \
|
||||||
--output /tmp/kind.sha256sum "https://kind.sigs.k8s.io/dl/${version}/kind-linux-amd64.sha256sum"
|
--output /tmp/kind.sha256sum \
|
||||||
printf '%s %s\n' "$(cut -d ' ' -f1 /tmp/kind.sha256sum)" /tmp/kind | sha256sum --check
|
"${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
|
chmod 0755 /tmp/kind
|
||||||
|
|
||||||
- name: Create and delete kind cluster
|
- name: Create and delete kind cluster
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
trap '/tmp/kind delete cluster --name smoke' EXIT
|
diagnose_and_cleanup() {
|
||||||
/tmp/kind create cluster --name smoke --wait 180s
|
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
|
/tmp/kind get clusters | grep -Fx smoke
|
||||||
|
|||||||
Reference in New Issue
Block a user