Skip to content

Build Live images

Build Live images #8

Workflow file for this run

name: Build Live images
on:
workflow_dispatch:
inputs:
version_major:
description: 'AlmaLinux major version'
required: true
default: '9'
type: choice
options:
- 9
- 8
GNOME:
description: 'GNOME'
required: true
type: boolean
default: false
GNOME-Mini:
description: 'GNOME-Mini'
required: true
type: boolean
default: true
KDE:
description: 'KDE'
required: true
type: boolean
default: false
MATE:
description: 'MATE'
required: true
type: boolean
default: false
XFCE:
description: 'XFCE'
required: true
type: boolean
default: false
jobs:
build-test-push:
name: Build ${{ inputs.version_major }} ${{ matrix.image_types }} media
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Set image types matrix based on boolean inputs.* with true value
image_types: ${{ fromJSON(format('["{0}", "{1}", "{2}", "{3}", "{4}"]', ( inputs.GNOME && 'GNOME' ), ( inputs.GNOME-Mini && 'GNOME-Mini' ), ( inputs.KDE && 'KDE' ), ( inputs.MATE && 'MATE' ), ( inputs.XFCE && 'XFCE' ) )) }}
exclude:
- image_types: 'false'
steps:
- uses: actions/checkout@v4
- name: Prepare AlmaLinux Minor version number
run: |
case ${{ inputs.version_major }} in
8)
version_minor="9" ;;
9)
version_minor="4" ;;
10)
version_minor="0" ;;
*)
echo "Almalinux ${{ inputs.version_major }} is not supported!" && false
esac
echo "version_minor=${version_minor}" >> $GITHUB_ENV
# [Debug]
echo "version_minor=${version_minor}"
- name: Prepare other stuff
run: |
# Name of repository to enable (PowerTools/CRB)
dnf_crb_repo='PowerTools'
if [ "${{ inputs.version_major }}" = "9" ]; then
dnf_crb_repo='CRB'
fi
echo "dnf_crb_repo=${dnf_crb_repo}" >> $GITHUB_ENV
# Verify that CPU supports hardware virtualization
echo -n "Number of vmx|svm CPUs: " && grep -E -c '(vmx|svm)' /proc/cpuinfo
# Use proper Vagrantfile and set ENV variable of config.vm.box
cp -av ci/vagrant/Vagrantfile ./
echo vm_box='almalinux/${{ inputs.version_major }}' > .env
# Kickstart file name
image_type=${{ matrix.image_types }}
image_type="${image_type,,}"
kickstart="almalinux-${{ inputs.version_major }}-live-${image_type}.ks"
echo "kickstart=${kickstart}" >> $GITHUB_ENV
- name: Install KVM Packages and Start libvirt
run: |
sudo apt-get -y update
sudo apt-get -y install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo systemctl enable --now libvirtd
sudo adduser "$(id -un)" libvirt
sudo adduser "$(id -un)" kvm
- name: Enable KVM group perms
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
- name: Tune libvirt
run: virsh list --all
- name: Install Vagrant
run: |
sudo apt-get -y install vagrant
sudo vagrant --version
sudo vagrant plugin install vagrant-reload
sudo vagrant plugin install vagrant-env
- name: Install the Vagrant libvirt Plugin
run: |
sudo cp /etc/apt/sources.list /etc/apt/sources.list."$(date +"%F")"
sudo sed -i -e '/^# deb-src.*universe$/s/# //g' /etc/apt/sources.list
sudo apt-get -y update
sudo apt-get -y install nfs-kernel-server
sudo systemctl enable --now nfs-server
sudo apt-get -y build-dep vagrant ruby-libvirt
sudo apt-get -y install ebtables dnsmasq-base
sudo apt-get -y install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
sudo vagrant plugin install vagrant-libvirt
sudo vagrant plugin install vagrant-scp
- name: Run vagrant up
run: sudo vagrant up almalinux
- name: Prepare build infrastructure
run: |
enable_repo=${{ env.dnf_crb_repo }}
sudo vagrant ssh almalinux -c "sudo dnf install -y --enablerepo=${enable_repo,,} lorax anaconda libblockdev-nvme"
- name: Get kickstarts
run: sudo vagrant ssh almalinux -c "sudo sh -c 'mkdir -p /sig-livemedia; cp -a /vagrant/kickstarts /sig-livemedia/'"
- name: Build media
run: sudo vagrant ssh almalinux -c "sudo livemedia-creator --ks=/sig-livemedia/kickstarts/${{ env.kickstart }} --no-virt --resultdir /vagrant/iso_${{ matrix.image_types }} --project 'AlmaLinux Live' --make-iso --iso-only --iso-name 'AlmaLinux-${{ inputs.version_major }}.${{ env.version_minor }}-x86_64-Live-${{ matrix.image_types }}.iso' --releasever 9.${{ env.version_minor }} --volid 'AlmaLinux-${{ inputs.version_major }}_${{ env.version_minor }}-Live-${{ matrix.image_types }}' --nomacboot --logfile /vagrant/logs_${{ matrix.image_types }}/livemedia.log"