Skip to content

Commit

Permalink
Try to run Vagrant
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Dec 21, 2024
1 parent 86e4a6b commit 8b92c92
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ on:
required: false

env:
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }}
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }}
PACKER_LOG: 1
VAGRANT_BOX_UPDATE_CHECK_DISABLE: 1
VAGRANT_CHECKPOINT_DISABLE: 1
VAGRANT_FORCE_COLOR: 1

jobs:
build:
Expand All @@ -53,14 +53,16 @@ jobs:
steps:
- run: nproc
- uses: actions/checkout@v4
with:
path: src
- run: >-
wget -O- https://apt.releases.hashicorp.com/gpg
| sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
- run: >-
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
- run: sudo apt-get update
- run: sudo apt-get install -y --no-install-recommends packer qemu-system-x86 qemu-utils
- run: sudo apt-get install -y --no-install-recommends packer qemu-system-x86 qemu-system-modules-spice qemu-utils vagrant libvirt-daemon-system libvirt-dev dnsmasq
- run: sudo apt-get clean -y
- run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
- run: sudo docker image prune --all --force
Expand All @@ -69,8 +71,30 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- run: packer init .
working-directory: src
- run: >-
packer build
${{ !inputs.publish && '-except vagrant-registry' || '' }}
-only qemu.${{ matrix.build }}
.
working-directory: src
env:
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }}
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }}
PACKER_LOG: 1
- run: mkdir test
- run: vagrant plugin install --verbose vagrant-libvirt
working-directory: test
- run: vagrant box add --clean --force --name ${{ matrix.build }} ../src/*.box
working-directory: test
- run: rm src/*.box
- run: vagrant init --template ../src/test/Vagrantfile.erb ${{ matrix.build }}
working-directory: test
- run: |
sudo mkdir -p /etc/qemu
echo "allow virbr0" | sudo tee /etc/qemu/bridge.conf
sudo chmod u+s /usr/lib/qemu/qemu-bridge-helper
- run: vagrant up
working-directory: test
- run: vagrant destroy --force --graceful
working-directory: test
4 changes: 4 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ Vagrant.configure(2) do |config|
end

config.vm.synced_folder '.', '/vagrant', disabled: true

if /^alpine\d+$/ =~ '{{build_name}}'
config.ssh.sudo_command = 'doas -n -u root %c'
end
end
13 changes: 13 additions & 0 deletions test/Vagrantfile.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Vagrant.configure("2") do |config|
config.vm.box = "<%= box_name %>"
<% if box_version -%>
config.vm.box_version = "<%= box_version %>"
<% end -%>
<% if box_url -%>
config.vm.box_url = "<%= box_url %>"
<% end -%>
config.vm.provider 'libvirt' do |libvirt, override|
libvirt.qemu_use_session = true
libvirt.video_accel3d = false
end
end

0 comments on commit 8b92c92

Please sign in to comment.