forked from chef/bento
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (88 loc) · 3.03 KB
/
pkr-bld-qemu-x64.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
on:
workflow_call:
env:
PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# PACKER_LOG: "1"
jobs:
x86_64:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- almalinux-8
- almalinux-9
- centos-stream-9
- debian-11
- debian-12
- fedora-39
- fedora-40
- freebsd-13
- freebsd-14
- opensuse-leap-15
- oraclelinux-8
- oraclelinux-9
- rockylinux-8
- rockylinux-9
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
provider:
- qemu
steps:
- name: Checkout
uses: actions/checkout@main
- name: Install Vagrant QEMU
run: |
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt-get update
sudo apt-get install -y software-properties-common vagrant qemu-kvm libvirt-daemon-system virtinst libvirt-clients bridge-utils qemu-utils libvirt-dev
vagrant plugin install vagrant-libvirt vagrant-qemu
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
sudo chmod o+rw /var/run/libvirt/libvirt-sock
sudo systemctl start libvirtd
sudo systemctl status libvirtd
- name: Install Chef
uses: actionshub/[email protected]
with:
version: 24.2.1058
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
version: latest
- name: Install Bento
run: |
eval "$(chef shell-init bash)"
gem build bento.gemspec
gem install bento-*.gem
- name: Bento build
run: |
rm -rf builds
sudo mkdir -p /mnt/builds/iso
sudo chmod -R 777 /mnt/builds
sudo ln -s /mnt/builds ./
eval "$(chef shell-init bash)"
bento build -o ${{ matrix.provider }}.vm --vars "qemu_accelerator=kvm" os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl"
ls -alh builds/
cat builds/${{ matrix.os }}*-x86_64._metadata.json
- name: Upload build artifact
uses: actions/upload-artifact@main
with:
name: "${{ matrix.os }}-qemu-x86_64"
path: |
builds/*.box
builds/*.json
retention-days: 10
compression-level: 0 # no compression
- name: Bento Test
run: |
eval "$(chef shell-init bash)"
bento test libvirt