-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathaction.yml
51 lines (46 loc) · 1.36 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: 'Setup LXD'
description: 'Install and configure LXD on the runner'
inputs:
channel:
default: 'latest/candidate'
description: 'Snap channel to install LXD from'
required: false
type: string
group:
default: 'adm'
description: 'Name of the group that will have access to LXD'
required: false
type: string
runs:
using: "composite"
steps:
- name: Install/refresh LXD snap
shell: bash
run: |
set -x
if snap list lxd; then
sudo snap refresh lxd --channel=${{ inputs.channel }}
else
sudo snap install lxd --channel=${{ inputs.channel }}
fi
- name: Set up permissions for socket
shell: bash
run: |
while [ -n "$(snap changes lxd 2>/dev/null | awk '/^[0-9]+/ {if ($2 != "Done") print $2 }')" ]; do
echo "Waiting for snap changes on LXD to finish"
sleep 1
done
sudo snap set lxd daemon.group=${{ inputs.group }}
- name: Initialise LXD
shell: bash
run: |
sudo lxd waitready
sudo lxd init --auto
- name: Configure firewall
shell: bash
run: |
set -x
if sudo iptables -L DOCKER-USER; then
sudo iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT
sudo iptables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
fi