Skip to content

Build Live images

Build Live images #56

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
store_as_artifact:
description: "Store media as action aftifact"
required: true
type: boolean
default: false
jobs:
build-media:
name: AlmaLinux ${{ inputs.version_major }} ${{ matrix.image_types }}
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="10" ;;
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
# List of the packages to prepare build env
need_pkgs="lorax anaconda"
if [ "${{ inputs.version_major }}" = "9" ]; then
need_pkgs="${need_pkgs} libblockdev-nvme"
fi
echo "need_pkgs=${need_pkgs}" >> $GITHUB_ENV
# Verify that CPU supports hardware virtualization
echo -n "Number of vmx|svm CPUs: " && grep -E -c '(vmx|svm)' /proc/cpuinfo
# Set ENV variable of for vagrant's 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
# Volume ID
volid="AlmaLinux-${{ inputs.version_major }}_${{ env.version_minor }}-x86_64-Live-${{ matrix.image_types }}"
echo ${{ matrix.image_types }} | grep -i mini >/dev/null && volid="AlmaLinux-${{ inputs.version_major }}_${{ env.version_minor }}-x86_64-Live-Mini"
echo "volid=${volid}" >> $GITHUB_ENV
# ISO media file name
iso_name="AlmaLinux-${{ inputs.version_major }}.${{ env.version_minor }}-x86_64-Live-${{ matrix.image_types }}.iso"
echo "iso_name=${iso_name}" >> $GITHUB_ENV
- name: Create media creator script
run: |
cat <<'EOF'>./livemedia-creator.sh
livemedia-creator \
--ks=/sig-livemedia/kickstarts/${{ env.kickstart }} \
--no-virt \
--resultdir /sig-livemedia/iso_${{ matrix.image_types}} \
--project "AlmaLinux Live" \
--make-iso \
--iso-only \
--iso-name "${{ env.iso_name }}" \
--releasever 9.${{ env.version_minor }} \
--volid "${{ env.volid }}" \
--nomacboot \
--logfile /sig-livemedia/logs/livemedia.log \
--anaconda-arg="--product AlmaLinux"
EOF
- 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 the Vagrant and need plugins
run: |
sudo apt-get -y install vagrant
sudo vagrant plugin install vagrant-reload
sudo vagrant plugin install vagrant-env
- name: Install Libvirt Plugins
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: Create 'mnt' Storage Pull
run: |
# sudo virsh pool-list
# sudo virsh pool-destroy default
# sudo virsh pool-undefine default
sudo virsh pool-define-as --name mnt --type dir --target /mnt
sudo virsh pool-autostart mnt
sudo virsh pool-start mnt
sudo virsh pool-list
- 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,,} ${{ env.need_pkgs }}"
# Create file-system and mount additional disk
sudo vagrant ssh almalinux -c "sudo mkfs.xfs -f /dev/vdb"
sudo vagrant ssh almalinux -c "sudo sh -c 'mkdir -p /sig-livemedia; mount /dev/vdb /sig-livemedia'"
- name: Get kickstarts and the script
run: |
sudo vagrant ssh almalinux -c "sudo sh -c 'cp -a /vagrant/kickstarts /sig-livemedia/; cp -a /vagrant/livemedia-creator.sh /sig-livemedia/'"
- name: Build media
run: |
# sudo vagrant ssh almalinux -c "sudo sh -c 'mkdir -p /sig-livemedia/iso_${{ matrix.image_types}} /sig-livemedia/logs/anaconda; touch /sig-livemedia/iso_${{ matrix.image_types}}/${{ env.iso_name }} /sig-livemedia/logs/livemedia.log /sig-livemedia/logs/anaconda/packaging.log'"
# sudo vagrant ssh almalinux -c "sudo livemedia-creator --ks=/sig-livemedia/kickstarts/${{ env.kickstart }} --no-virt --resultdir /sig-livemedia/iso_${{ matrix.image_types}} --project 'AlmaLinux Live' --make-iso --iso-only --iso-name '${{ env.iso_name }}' --releasever 9.${{ env.version_minor }} --volid '${{ env.volid }}' --nomacboot --logfile /sig-livemedia/logs/livemedia.log --anaconda-arg='--product AlmaLinux'"
sudo vagrant ssh almalinux -c "sudo bash /sig-livemedia/livemedia-creator.sh"
- name: Get media
if: inputs.store_as_artifact
id: get-media
run: |
sudo vagrant scp almalinux:/sig-livemedia/iso_${{ matrix.image_types}}/${{ env.iso_name }} ${{github.action_path}}/
- name: Collect livemedia-creator logs
if: success() || failure()
run: |
sudo vagrant scp almalinux:/sig-livemedia/logs/*.log ${{github.action_path}}/
- name: Collect anaconda logs
if: success() || failure()
run: |
sudo vagrant ssh almalinux -c "sudo sh -c 'chmod o+r /sig-livemedia/logs/anaconda/*.log'"
sudo vagrant scp almalinux:/sig-livemedia/logs/anaconda/*.log ${{github.action_path}}/
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: AlmaLinux-${{ inputs.version_major }}.${{ env.version_minor }}-x86_64-Live-${{ matrix.image_types }}-logs
path: ${{github.action_path}}/*.log
- uses: actions/upload-artifact@v4
if: steps.get-media.outcome == 'success' && inputs.store_as_artifact
with:
name: ${{ env.iso_name }}
compression-level: 0
path: ${{github.action_path}}/${{ env.iso_name }}