mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 19:07:54 +01:00
run a second test with bootc installed
This commit is contained in:
parent
13876998bf
commit
7a2a937cc6
1 changed files with 149 additions and 1 deletions
150
.github/workflows/build-and-test.yml
vendored
150
.github/workflows/build-and-test.yml
vendored
|
|
@ -1,4 +1,4 @@
|
|||
name: Create and publish an ISO
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -8,6 +8,11 @@ on:
|
|||
- 'v*'
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
|
||||
# Test Values
|
||||
env:
|
||||
ARCH: 'x86_64'
|
||||
|
|
@ -21,6 +26,7 @@ env:
|
|||
|
||||
jobs:
|
||||
build-container:
|
||||
name: Build Container Image
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -62,6 +68,7 @@ jobs:
|
|||
password: ${{ github.token }}
|
||||
|
||||
build-and-push-iso:
|
||||
name: Build ISO
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-container
|
||||
|
|
@ -133,6 +140,7 @@ jobs:
|
|||
overwrite: true
|
||||
|
||||
test-qemu:
|
||||
name: Test ISO
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-and-push-iso
|
||||
|
|
@ -267,3 +275,143 @@ jobs:
|
|||
|
||||
#make test-vm
|
||||
kill $QEMU_PID
|
||||
|
||||
test-qemu-bootc:
|
||||
name: Test ISO with Bootc
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-and-push-iso
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
continue-on-error: false
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version:
|
||||
- 38
|
||||
- 39
|
||||
- 40
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Ensure qemu is installed
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y qemu qemu-utils xorriso unzip qemu-system-x86 netcat socat jq isomd5sum ansible make coreutils
|
||||
|
||||
- name: Create disk
|
||||
run: |
|
||||
qemu-img create -f qcow2 disk.qcow2 50G
|
||||
|
||||
- name: Download generated ISO
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ needs['build-and-push-iso']['outputs'][format('iso_name-{0}', matrix.version)] }}
|
||||
|
||||
- name: Verify ISO
|
||||
run: |
|
||||
checkisomd5 ${{ needs['build-and-push-iso']['outputs'][format('iso_name-{0}', matrix.version)] }}
|
||||
sha256sum -c ${{ needs['build-and-push-iso']['outputs'][format('iso_name-{0}', matrix.version)] }}-CHECKSUM
|
||||
|
||||
- name: Run ISO checks
|
||||
run: |
|
||||
mv ${{ needs['build-and-push-iso']['outputs'][format('iso_name-{0}', matrix.version)] }} deploy.iso
|
||||
make test-iso \
|
||||
ARCH=${{ env.ARCH}} \
|
||||
IMAGE_NAME=${{ env.IMAGE_NAME}} \
|
||||
IMAGE_REPO=${{ env.IMAGE_REPO}} \
|
||||
IMAGE_TAG=${{ env.IMAGE_TAG }} \
|
||||
VERSION=${{ matrix.version }} \
|
||||
VARIANT=${{ env.VARIANT }} \
|
||||
FLATPAK_REMOTE_REFS_DIR=${{ env.FLATPAK_REMOTE_REFS_DIR }} \
|
||||
SECURE_BOOT_KEY_URL=${{ env.SECURE_BOOT_KEY_URL }} \
|
||||
ENROLLMENT_PASSWORD=${{ env.ENROLLMENT_PASSWORD }}
|
||||
|
||||
- name: Add Kickstart and Grub options to ISO
|
||||
run: |
|
||||
sudo mkdir /mnt/iso || true
|
||||
sudo mount -o loop deploy.iso /mnt/iso
|
||||
cp /mnt/iso/boot/grub2/grub.cfg grub.cfg
|
||||
sudo umount /mnt/iso
|
||||
sed -i 's/quiet/console=ttyS0,115200n8 inst.ks=cdrom:\/ks.cfg/' grub.cfg
|
||||
sed -i 's/set default="1"/set default="0"/' grub.cfg
|
||||
sed -i 's/set timeout=60/set timeout=1/' grub.cfg
|
||||
cat << EOF > ks.cfg
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
timezone Americas/New_York
|
||||
zerombr
|
||||
clearpart --all --initlabel
|
||||
autopart
|
||||
poweroff
|
||||
user --name=core --groups=wheel --password=foobar
|
||||
%post --erroronfail
|
||||
rpm-ostree install bootc
|
||||
%end
|
||||
%include /usr/share/anaconda/interactive-defaults.ks
|
||||
EOF
|
||||
xorriso -dialog on << EOF
|
||||
-indev deploy.iso
|
||||
-outdev test.iso
|
||||
-boot_image any replay
|
||||
-map ks.cfg ks.cfg
|
||||
-chmod 0444 ks.cfg
|
||||
-map grub.cfg boot/grub2/grub.cfg
|
||||
-end
|
||||
EOF
|
||||
|
||||
- name: Install the test VM
|
||||
run: |
|
||||
timeout 1h qemu-system-x86_64 -name "Anaconda" -boot d -m 4096 -cpu qemu64 -display none -cdrom test.iso -smp 2 -hda disk.qcow2 -serial telnet:localhost:4321,server,nowait & QEMU_PID=$!
|
||||
echo "PID: $QEMU_PID"
|
||||
timeout 1m bash -c "while ! (echo > /dev/tcp/127.0.0.1/4321); do sleep 0.1; done"
|
||||
(nc localhost 4321 | tee vm.stdout) &
|
||||
wait $QEMU_PID
|
||||
|
||||
- name: Start the test VM
|
||||
env:
|
||||
VM_USER: core
|
||||
VM_PASS: foobar
|
||||
VM_IP: "127.0.0.1"
|
||||
VM_PORT: "5555"
|
||||
run: |
|
||||
mkfifo vm.stdin
|
||||
qemu-system-x86_64 -name "Anaconda" \
|
||||
-m 4096 -cpu qemu64 -display none -smp 2 \
|
||||
-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 \
|
||||
-device e1000,netdev=net0 \
|
||||
-netdev user,id=net0,hostfwd=tcp::${VM_PORT}-:22 \
|
||||
-device virtio-serial \
|
||||
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
|
||||
-boot c -hda disk.qcow2 -serial telnet:localhost:4321,server,nowait & export QEMU_PID=$!
|
||||
echo "PID: $QEMU_PID"
|
||||
|
||||
timeout 1m bash -c "while ! (echo > /dev/tcp/127.0.0.1/4321); do sleep 0.1; done"
|
||||
(tail -f vm.stdin | nc localhost 4321 | tee vm.stdout) &
|
||||
|
||||
timeout 30m bash -c "while ! (grep 'login:' vm.stdout); do sleep 1; done"
|
||||
|
||||
if ! (echo > /dev/tcp/${VM_IP}/${VM_PORT})
|
||||
then
|
||||
echo "SSH must be installed and enabled inside the container"
|
||||
fi
|
||||
|
||||
echo "VM ready for tests at IP ${VM_IP}:${VM_PORT}"
|
||||
echo "Creating Ansible inventory"
|
||||
cat << EOF > ansible_inventory
|
||||
ungrouped:
|
||||
hosts:
|
||||
vm:
|
||||
ansible_host: ${VM_IP}
|
||||
ansible_port: ${VM_PORT}
|
||||
ansible_user: ${VM_USER}
|
||||
ansible_password: ${VM_PASS}
|
||||
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
|
||||
EOF
|
||||
|
||||
#make test-vm
|
||||
kill $QEMU_PID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue