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 ed8b364 commit a1b7d89
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ on:
description: 'HCP service principal client secret for publishing'
required: false

env:
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }}
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }}
PACKER_LOG: 1

jobs:
build:
strategy:
Expand All @@ -51,14 +46,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
- 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 @@ -67,9 +64,30 @@ jobs:
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- run: packer init .
working-directory: src
- run: >-
packer build
-var version=${{ inputs.version }}
${{ !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 --color --no-tty vagrant-libvirt
working-directory: test
- run: vagrant box add --color --no-tty --clean --force --name ${{ matrix.build }} ../src/*.box
working-directory: test
- run: vagrant init --color --no-tty --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 --color --no-tty
working-directory: test
- run: vagrant destroy --color --no-tty --force --graceful
working-directory: test
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 a1b7d89

Please sign in to comment.