CI: extract VM provisioning into host scripts

Kernel module loading and guest package setup are embedded in the VM
workflow. This was sufficient when the guest only hosted the DIND
development container, but native testing needs provisioning that can
also be run and checked outside GitHub Actions.

Move the existing commands into hack/host scripts, executed as root in
the guest. Keep the socket's login user supplied by the runner so this
preparatory refactor preserves the existing Docker setup.

Assisted-by: Codex
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda committed 2026-09-15 14:03:22 +09:00
1 parent f29c5d8007
commit fc44b26e58
3 files changed
+46 -35

No files matched your search

+2 -35
View File
@@ -77,45 +77,12 @@ jobs:
-
name: Load kernel modules in the guest VM
run: |
set -eux -o pipefail
cat <<-EOF | lima sudo tee /etc/modules-load.d/docker.conf
br_netfilter
bridge
ip6_tables
ip6table_filter
ip6table_nat
ip_tables
ip_vs
iptable_filter
iptable_nat
nf_tables
overlay
tap
tun
veth
x_tables
xt_addrtype
xt_comment
xt_conntrack
xt_mark
xt_multiport
xt_nat
xt_tcpudp
EOF
lima sudo systemctl restart systemd-modules-load.service
lima sudo bash < hack/host/load-kernel-modules.sh
-
name: Install dockerd in the guest VM
run: |
set -eux -o pipefail
lima sudo mkdir -p /etc/systemd/system/docker.socket.d
cat <<-EOF | lima sudo tee /etc/systemd/system/docker.socket.d/override.conf
[Socket]
SocketUser=$(whoami)
EOF
# TODO: use native packages for AlmaLinux: https://github.com/docker/packaging/pull/138
lima sudo dnf config-manager --add-repo=https://download.docker.com/linux/rhel/docker-ce.repo
lima sudo dnf -q -y install --nobest docker-ce make git
lima sudo systemctl enable --now docker
lima sudo bash -s -- "$(whoami)" < hack/host/provision.sh
lima docker info
-
name: Copy the current directory
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -eux -o pipefail
cat << EOF > /etc/modules-load.d/docker.conf
br_netfilter
bridge
ip6_tables
ip6table_filter
ip6table_nat
ip_tables
ip_vs
iptable_filter
iptable_nat
nf_tables
overlay
tap
tun
veth
x_tables
xt_addrtype
xt_comment
xt_conntrack
xt_mark
xt_multiport
xt_nat
xt_tcpudp
EOF
systemctl restart systemd-modules-load.service
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -eux -o pipefail
# The argument is the login user that will run Docker in the guest.
mkdir -p /etc/systemd/system/docker.socket.d
cat <<- EOF | tee /etc/systemd/system/docker.socket.d/override.conf
[Socket]
SocketUser=$1
EOF
# TODO: use native packages for AlmaLinux: https://github.com/docker/packaging/pull/138
dnf config-manager --add-repo=https://download.docker.com/linux/rhel/docker-ce.repo
dnf -q -y install --nobest docker-ce make git
systemctl enable --now docker