add 9u2 Vagrantfiles

This commit is contained in:
Trevor Cooper 2023-05-28 23:06:18 -07:00
parent 68b2cbfc4d
commit 45973d6a5a
Signed by: tcooper
GPG Key ID: 52364D7BBCEB35B8
6 changed files with 198 additions and 0 deletions

32
centos/Vagrantfile vendored Normal file
View File

@ -0,0 +1,32 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "boxomatic/centos-stream-9"
config.vm.hostname = "centos-stream-9-repotesting.example.org"
config.vm.synced_folder "../vagrantdata", "/home/vagrant/data"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = "2"
end
config.vm.provision "shell", inline: <<-SHELL
dnf -y update
SHELL
config.vm.provision "shell", inline: <<-SHELL
dnf install -y diffstat jq python3-jsonpatch rpminspect rpminspect-data-fedora rpminspect-data-centos vim-enhanced
SHELL
config.vm.provision "shell", inline: <<-SHELL
# This will either rebuild the kernel modules for the running kernel or build
# the kernel modules for an updated kernel if a newer one exists
kver=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}.%{ARCH}\n" kernel | sort -V | tail -n 1)
test -x /sbin/rcvboxadd && /sbin/rcvboxadd quicksetup "${kver}"
SHELL
config.vm.provision :reload
end

32
rhel/README.md Normal file
View File

@ -0,0 +1,32 @@
# README for rhel box
## Redhat Subscription required
A Redhat Subscription is required to install the additional packages
required to complete the testing this box was developed to perform and
registration/deregistration code is added to the box Vagrantfile to
support / accomodate this.
A Redhat Developer Subscription entitlement is sufficient to meet this
requirement.
## VirtualBox Guest Additions rebuild
Due to the challenge of building this box for RHEL 9.2 (the base box is
RHEL 9.1) and adding VirtualBox Guest Additions to support Shared Folders
you probably want to save the box after first build instead of destroying
and recreating it each time it is to be used.
## video issue on VirtualBox 7 with macOS Ventura
If you are running VirtualBox on Linux or VirtualBox 6 on a macOS version
prior to Ventura the following issues may not pertain to your setup.
The generic/rhel9 box has boot issue on VirtualBox 7 (verified up to version
7.0.8) where box will have very low video performance.
The issue can be worked around by disabling the `vga=792` kernel boot arg
on first boot.
Following that the box will be updated and appear to work normally.

88
rhel/Vagrantfile vendored Normal file
View File

@ -0,0 +1,88 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# configs, custom updates defaults
defaults_cfg = YAML.load_file('vagrant-settings.yaml_defaults')
if File.exist?('vagrant-settings.yaml')
custom_cfg = YAML.load_file('vagrant-settings.yaml')
cfg = defaults_cfg.merge(custom_cfg)
else
cfg = defaults_cfg
end
Vagrant.configure("2") do |config|
config.vm.box = "generic/rhel9"
config.vm.hostname = "rhel9u2.example.org"
config.vm.synced_folder "../vagrantdata", "/home/vagrant/data"
config.vm.provider "virtualbox" do |vb|
# vb.gui = true is needed so we can modify the initial boot command line in
# VirtualBox 7.0.8 on macOS Ventura as there appears to be a regression in
# VboxSVGA driver. Possible that a test build of 7.0.9 (or newer) may
# resolve but I've not tested that.
# For whatever reason in VB7 on macOS removing the vga=792 (1024x768x24)
# kernel boot option will temporarily resolve the issue.
# Access to the boot menu in VB7 on macOS by pressing fn-F12 early in
# the boot sequence and modify kernel boot params to remove vga=792.
vb.gui = true
vb.memory = "2048"
vb.cpus = "2"
end
# Unregister from rhsm if registered
config.trigger.before :destroy do |trigger|
trigger.warn = "Unregistering from rhsm"
trigger.run_remote = {inline: "subscription-manager status || exit 0;subscription-manager remove --all; subscription-manager unregister"}
end
# Must be registered to update and/or install packages
config.vm.provision "shell", inline: <<-SHELL
subscription-manager register --force \
--auto-attach \
--username=#{cfg["rhsm_username"]} \
--password=#{cfg["rhsm_password"]}
SHELL
config.vm.provision "shell", inline: <<-SHELL
dnf -y update
SHELL
config.vm.provision "shell", inline: <<-SHELL
dnf -y --enablerepo=epel install diffstat jq python3-jsonpatch rpminspect rpminspect-data-generic vim-enhanced
SHELL
# NOTE: Current generic/rocky9 box is RHEL 9.1 and the above `dnf -y update` will upgrade
# it to RHEL 9.2. This will include a new kernel and will break support for VirtualBox
# Shared Folders. You will need to build a new kmod for the updated kernel.
# In the centos/rocky Vagrant machines this is straight-forward as the boxomatic
# boxes leave the build requirements installed. The generic/rhel9 box has these
# removed so more work is required to get working vboxsf kmod.
config.vm.provision "shell", inline: <<-SHELL
dnf install -y gcc make perl kernel-devel kernel-headers bzip2 dkms
cd /dev/shm
# NOTE: If you are running an older version of VirtualBox probably better to download
# matching VBoxGuestAdditions_<ver>.iso and install from that.
curl -LOR https://download.virtualbox.org/virtualbox/7.0.8/VBoxGuestAdditions_7.0.8.iso
mkdir -p /mnt/virtualbox
mount -o loop /dev/shm/VBoxGuestAdditions_7.0.8.iso /mnt/virtualbox
/mnt/virtualbox VBoxLinuxAdditions.run --nox11
# This will either rebuild the kernel modules for the running kernel or build
# the kernel modules for an updated kernel if a newer one exists
kver=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}.%{ARCH}\n" kernel | sort -V | tail -n 1)
test -x /sbin/rcvboxadd && /sbin/rcvboxadd quicksetup "${kver}"
SHELL
config.vm.provision :reload
# NOTE: If, after reload, the box doesn't mount the VirtualBox shared folders
# try installing the Guest Additions again following the sequence above
# and then halt and up the box.
end

View File

@ -0,0 +1,2 @@
rhsm_username: admin
rhsm_password: secret

33
rocky/Vagrantfile vendored Normal file
View File

@ -0,0 +1,33 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "boxomatic/rocky-9"
config.vm.box_version = "20230520.0.1"
config.vm.hostname = "rocky9u2-repotesting.example.org"
config.vm.synced_folder "../vagrantdata", "/home/vagrant/data"
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = "2"
end
config.vm.provision "shell", inline: <<-SHELL
dnf -y update
SHELL
config.vm.provision "shell", inline: <<-SHELL
dnf install -y diffstat jq python3-jsonpatch rpminspect rpminspect-data-fedora vim-enhanced
SHELL
config.vm.provision "shell", inline: <<-SHELL
# This will either rebuild the kernel modules for the running kernel or build
# the kernel modules for an updated kernel if a newer one exists
kver=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}.%{ARCH}\n" kernel | sort -V | tail -n 1)
test -x /sbin/rcvboxadd && /sbin/rcvboxadd quicksetup "${kver}"
SHELL
config.vm.provision :reload
end

11
vagrantdata/README.md Normal file
View File

@ -0,0 +1,11 @@
# Vagrantdata directory
Boxes will use VirtualBox Shared Folders to mount this directory to /vagrant/data.
Any information that should be persisted between provisioning cycles of the boxes or
perhaps shared between boxes for different OS at the same version of different versions of the same OS for analysis should be located here.
## repotesting repository
The `repotesting` repository which holds the scripts used to run `rpminspect` on Rocky Linux and, optionally, upstream packages can be cloned into this directory and will not be commited into this repository as well.