From 63a11860630a3deba9e7a8da06eee2d0a32b9202 Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Wed, 24 Apr 2024 10:44:21 -0600 Subject: [PATCH] wip --- .github/workflows/alpine-unittests.yml | 36 ++++++++++---------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/workflows/alpine-unittests.yml b/.github/workflows/alpine-unittests.yml index 2e41d997521..0bc50c93e7a 100644 --- a/.github/workflows/alpine-unittests.yml +++ b/.github/workflows/alpine-unittests.yml @@ -28,42 +28,32 @@ jobs: # Fetch all tags for tools/read-version fetch-depth: 0 - - name: Reset the firewall - run: | - sudo iptables -I DOCKER-USER -j ACCEPT - - - name: Make sure the latest version is installed - run: | - sudo snap refresh lxd --channel latest/stable - - - name: Init lxd - run: | - sudo lxd admin init --auto - - # we shouldn't have to do this, but the link is down and we need it up - sudo ip link set lxdbr0 up + - name: Setup LXD + uses: canonical/setup-lxd@v0.1.1 + with: + channel: latest/candidate - name: Create alpine container # the current shell doesn't have lxd as one of the groups # so switch groups to run lxd commands - run: sudo sg lxd -c 'lxc launch images:alpine/edge alpine' + run: lxc launch images:alpine/edge alpine - name: Check networking (for debugging) run: | - sudo sg lxd -c 'lxc exec alpine -- ping -c 1 google.com || true' - sudo sg lxd -c 'lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true' - sudo sg lxd -c 'lxc exec alpine -- nslookup www.google.com || true' - sudo sg lxd -c 'lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true' + lxc exec alpine -- ping -c 1 google.com || true + lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true + lxc exec alpine -- nslookup www.google.com || true + lxc exec alpine -- ping -c 1 dl-cdn.alpinelinux.org || true - name: Install dependencies - run: sudo sg lxd -c 'lxc exec alpine -- apk add py3-tox git' + run: lxc exec alpine -- apk add py3-tox git - name: Mount source into container directory - run: sudo sg lxd -c 'lxc config device add alpine gitdir disk source=$(pwd) path=/root/cloud-init-ro' + run: lxc config device add alpine gitdir disk source=$(pwd) path=/root/cloud-init-ro - name: Create a r/w directory to run tests in # without this, tox fails during package install - run: sudo sg lxd -c 'lxc exec alpine -- git clone cloud-init-ro/ cloud-init-rw' + run: lxc exec alpine -- git clone cloud-init-ro/ cloud-init-rw - name: Run unittests - run: sudo sg lxd -c 'lxc exec alpine --cwd /root/cloud-init-rw -- sh -c "tox -e py3"' + run: lxc exec alpine --cwd /root/cloud-init-rw -- sh -c "tox -e py3"