adding build images
All checks were successful
Test Actions (self-test) / Test Kubernetes actions (push) Successful in 8s
Test Actions (self-test) / Build tiny multi-arch image (push) Successful in 9s
Test Actions (self-test) / Test SSH deploy action (push) Successful in 15s
Build and Push Runner Images / Build Slim Runner Image (push) Successful in 1m24s
Build and Push Runner Images / Build Full Runner Image (push) Successful in 3m51s

This commit is contained in:
2026-07-13 21:11:42 -03:00
parent de1ecdf5bd
commit ef3dd4f81c
5 changed files with 219 additions and 6 deletions

View File

@@ -38,15 +38,66 @@ runs:
env:
KUBE_VERSION: ${{ inputs.kube_version }}
run: |
apt-get update -y
apt-get install -y curl
# strip stray CR (CRLF checkout via core.autocrlf)
KUBE_VERSION=$(printf '%s' "${KUBE_VERSION}" | tr -d '\r')
# 1. Check if kubectl is already pre-installed and meets version requirements
if command -v kubectl &> /dev/null; then
INSTALLED_VER=$(kubectl version --client --output=json 2>/dev/null | grep -oE '"gitVersion": "[^"]+"' | cut -d'"' -f4)
if [ -z "${INSTALLED_VER}" ]; then
INSTALLED_VER=$(kubectl version --client 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')
fi
echo "Found pre-installed kubectl version: ${INSTALLED_VER}"
# If stable or version matches, reuse pre-installed kubectl
if [ "${KUBE_VERSION}" = "stable" ] || [ "${INSTALLED_VER}" = "${KUBE_VERSION}" ]; then
echo "Using pre-installed kubectl."
exit 0
fi
fi
# 2. Check/install curl if missing
if ! command -v curl &> /dev/null; then
echo "curl not found, attempting to install..."
if command -v apt-get &> /dev/null; then
apt-get update -y && apt-get install -y curl
elif command -v apk &> /dev/null; then
apk add --no-cache curl
elif command -v dnf &> /dev/null; then
dnf install -y curl
elif command -v yum &> /dev/null; then
yum install -y curl
else
echo "::error::curl is missing and no supported package manager (apt-get, apk, dnf, yum) was found."
exit 1
fi
fi
# 3. Resolve version
if [ "${KUBE_VERSION}" = "stable" ]; then
KUBE_VER="$(curl -L -s https://dl.k8s.io/release/stable.txt)"
else
KUBE_VER="${KUBE_VERSION}"
fi
# 4. Download kubectl
echo "Downloading kubectl version ${KUBE_VER}..."
curl -LO "https://dl.k8s.io/release/${KUBE_VER}/bin/linux/amd64/kubectl"
install -m 0755 kubectl /usr/local/bin/kubectl
# 5. Install kubectl to a writable directory
if [ -w "/usr/local/bin" ]; then
install -m 0755 kubectl /usr/local/bin/kubectl
echo "Installed kubectl to /usr/local/bin"
else
echo "/usr/local/bin is not writable. Installing locally and updating PATH..."
LOCAL_BIN="${HOME}/.local/bin"
mkdir -p "${LOCAL_BIN}"
install -m 0755 kubectl "${LOCAL_BIN}/kubectl"
echo "${LOCAL_BIN}" >> "$GITHUB_PATH"
export PATH="${LOCAL_BIN}:${PATH}"
echo "Installed kubectl to ${LOCAL_BIN}"
fi
kubectl version --client
- name: Set up kubeconfig