fix: detect mounted kubectl first, skip download
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5s

This commit is contained in:
zyc 2026-04-13 19:27:25 +08:00
parent c6d5a1c935
commit 7601ca5443

View File

@ -70,15 +70,14 @@ jobs:
- name: Setup Kubectl - name: Setup Kubectl
run: | run: |
if ! command -v kubectl &>/dev/null; then if [ -f /usr/local/bin/kubectl ]; then
echo "kubectl not found, using mounted binary or downloading..." echo "Using mounted kubectl"
if [ -f /usr/local/bin/kubectl ]; then elif command -v kubectl &>/dev/null; then
echo "kubectl found at /usr/local/bin/kubectl" echo "kubectl already in PATH"
else else
curl -LO "https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl" || \ echo "Downloading kubectl..."
curl -LO "https://files.m.daocloud.io/dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl" curl -sLO "https://dl.k8s.io/release/v1.28.0/bin/linux/amd64/kubectl"
chmod +x kubectl && mv kubectl /usr/bin/kubectl chmod +x kubectl && mv kubectl /usr/local/bin/kubectl
fi
fi fi
kubectl version --client kubectl version --client