mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-11-30 23:16:04 +07:00
CI: simplify setting up Lima
https://github.com/lima-vm/lima-actions is used Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
31
.github/workflows/vm.yaml
vendored
31
.github/workflows/vm.yaml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
vm:
|
||||
# Fedora is different from Ubuntu in LSM (SELinux), filesystem (btrfs), kernel version, etc.
|
||||
name: "CGroupv2 (Fedora)"
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -23,7 +23,6 @@ jobs:
|
||||
provider: [docker, podman]
|
||||
rootless: ["rootful", "rootless"]
|
||||
env:
|
||||
LIMA_VERSION: "0.23.2" # Fedora 40
|
||||
KIND_EXPERIMENTAL_PROVIDER: "${{ matrix.provider }}"
|
||||
ROOTLESS: "${{ matrix.rootless }}"
|
||||
HELPER: "./hack/ci/lima-helper.sh"
|
||||
@@ -44,44 +43,32 @@ jobs:
|
||||
go-version: ${{ steps.golangversion.outputs.go_version }}
|
||||
check-latest: true
|
||||
|
||||
- name: "Install QEMU"
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
|
||||
sudo modprobe kvm
|
||||
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
|
||||
sudo chown $(whoami) /dev/kvm
|
||||
|
||||
- name: "Install Lima"
|
||||
run: curl -fsSL https://github.com/lima-vm/lima/releases/download/v${LIMA_VERSION}/lima-${LIMA_VERSION}-Linux-x86_64.tar.gz | sudo tar Cxzvf /usr/local -
|
||||
uses: lima-vm/lima-actions/setup@v1
|
||||
id: lima-actions-setup
|
||||
|
||||
- name: "Cache ~/.cache/lima"
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/lima
|
||||
key: lima-${{ env.LIMA_VERSION }}
|
||||
key: lima-${{ steps.lima-actions-setup.outputs.version }}
|
||||
|
||||
- name: "Start Fedora"
|
||||
# --plain is set to disable file sharing, port forwarding, built-in containerd, etc.
|
||||
run: limactl start --name=default --plain template://fedora
|
||||
|
||||
- name: "Initialize Fedora"
|
||||
# plain old rsync and ssh are used for the initialization of the guest,
|
||||
# so that people who are not familiar with Lima can understand the initialization steps.
|
||||
run: |
|
||||
set -eux -o pipefail
|
||||
# Initialize SSH
|
||||
mkdir -p -m 0700 ~/.ssh
|
||||
cat ~/.lima/default/ssh.config >> ~/.ssh/config
|
||||
# Sync the current directory to /tmp/kind in the guest
|
||||
rsync -a -e ssh . lima-default:/tmp/kind
|
||||
limactl cp -r . default:/tmp/kind
|
||||
# Install packages
|
||||
ssh lima-default sudo /tmp/kind/hack/ci/init-fedora.sh
|
||||
lima sudo /tmp/kind/hack/ci/init-fedora.sh
|
||||
# Enable systemd lingering for rootless
|
||||
ssh lima-default sudo loginctl enable-linger "$USER"
|
||||
lima sudo loginctl enable-linger "$USER"
|
||||
# Install kind
|
||||
ssh lima-default sudo git config --global --add safe.directory /tmp/kind
|
||||
ssh lima-default sudo make -C /tmp/kind install INSTALL_DIR=/usr/local/bin
|
||||
lima sudo git config --global --add safe.directory /tmp/kind
|
||||
lima sudo make -C /tmp/kind install INSTALL_DIR=/usr/local/bin
|
||||
|
||||
- name: Set up Rootless Docker
|
||||
if: ${{ matrix.provider == 'docker' && matrix.rootless == 'rootless' }}
|
||||
|
||||
@@ -15,10 +15,8 @@
|
||||
|
||||
set -o errexit -o nounset -o pipefail
|
||||
|
||||
: "${LIMA_INSTANCE:=default}"
|
||||
: "${KIND_EXPERIMENTAL_PROVIDER:=docker}"
|
||||
|
||||
if [ "$ROOTLESS" = "rootless" ]; then
|
||||
exec ssh "lima-${LIMA_INSTANCE}" KIND_EXPERIMENTAL_PROVIDER="$KIND_EXPERIMENTAL_PROVIDER" "${@}"
|
||||
fi
|
||||
exec ssh "lima-${LIMA_INSTANCE}" sudo KIND_EXPERIMENTAL_PROVIDER="$KIND_EXPERIMENTAL_PROVIDER" "${@}"
|
||||
sudo=sudo
|
||||
[ "$ROOTLESS" = "rootless" ] && sudo=
|
||||
exec lima $sudo KIND_EXPERIMENTAL_PROVIDER="$KIND_EXPERIMENTAL_PROVIDER" "${@}"
|
||||
|
||||
Reference in New Issue
Block a user