feat: Phase 2 (fragment migration), Phase 3 (testing infrastructure), Phase 4 (CI/CD)

Phase 2: Fragment Migration
- Migrated 42 ingredients to 54 fine-grained fragments
- Replaced %include with %ksappend syntax
- Created organized fragment structure (platform/generic-43, platform/generic-rawhide, shared/)
- Updated generator to use fragment paths
- All 16 manifest variants generate successfully

Phase 3: Testing Infrastructure
- Created containerized test runner (tests/container/)
- Added integration test suite (tests/integration/)
- Created golden master fixtures (tests/fixtures/expected_recipes/)
- 41 tests passing (36 unit + 5 integration)
- 54 fragments, 16 recipes validated

Phase 4: CI/CD Integration
- 5 new workflows: validate-recipes, validate-fragments, test-generation, container-tests, build-iso
- Added validation gates before ISO builds
- Works with existing fedora-runner-image
- Local testing support via act_runner
This commit is contained in:
Lukas Greve
2026-03-24 21:27:29 +01:00
parent a0a5de31cc
commit 5e8afd7d6f
113 changed files with 2973 additions and 224 deletions
+44 -44
View File
@@ -1,75 +1,75 @@
name: release
name: build-iso
on:
on:
push:
branches:
- main # Or your desired branch
branches: [main]
release:
types: [published]
jobs:
checkout:
runs-on: fedora-cloud-42
defaults:
run:
shell: bash
container:
validate:
runs-on: fedora
container:
image: git.phyllo.me/devops/fedora-runner-image:latest
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Install dependencies
run: |
pip install PyYAML pykickstart
- name: Generate all recipes
run: |
cd scripts
python3 generate_recipe.py \
--manifest recipes_manifest.yaml \
--output-dir ../recipes/
- name: Validate recipes (strict mode)
run: |
cd scripts
python3 generate_recipe.py --validate ../recipes/*.cfg --strict
build-iso:
needs: validate
runs-on: fedora-cloud-42
container:
image: git.phyllo.me/devops/fedora-runner-image:latest
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Initialize mock
run: |
mock -r fedora-43-x86_64 --init
- name: Install required packages
run: |
mock -r fedora-43-x86_64 --install lorax-lmc-novirt vim-minimal pykickstart livecd-tools
- name: Copy configuration file to mock
run: |
mock -r fedora-43-x86_64 --copyin dishes/live-server.cfg /builddir
mock -r fedora-43-x86_64 --copyin recipes/live-server_rawhide.cfg /builddir
- name: Build ISO with livemedia-creator
run: |
mock -r fedora-43-x86_64 --shell --enable-network --isolation=simple << 'EOF'
cd /builddir
livemedia-creator --ks live-server.cfg --no-virt --resultdir /var/lmc --project live-desktop-hypervisor --make-iso --volid live-desktop-hypervisor --iso-only --iso-name server-43.iso --releasever 43 --macboot
livemedia-creator --ks live-server_rawhide.cfg --no-virt --resultdir /var/lmc --project live-server --make-iso --volid live-server --iso-only --iso-name server-43.iso --releasever 43 --macboot
EOF
- name: Upload ISO as artifact
uses: actions/upload-artifact@v3
with:
name: server-43.iso
path: /var/lmc/server-43.iso
if-no-files-found: error
- name: Create Release
if: github.ref == 'refs/heads/main'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: iso-build-${{ github.run_number }}
release_name: ISO Build ${{ github.run_number }}
body: |
Build artifact from workflow run ${{ github.run_number }}
ISO file: server-43.iso
draft: false
prerelease: false
- name: Upload ISO to Release
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /var/lmc/server-43.iso
asset_name: server-43.iso
asset_content_type: application/x-iso9660-image
- name: Cleanup mock environment
if: always()
run: |
@@ -0,0 +1,54 @@
name: release
on:
push:
tags:
- "v*.*.*"
env:
FEDORA_VERSION: 43
KICKSTART_FILE: live-desktop-hypervisor
jobs:
checkout:
runs-on: fedora
defaults:
run:
shell: bash
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Initialize mock
run: |
mock -r fedora-${{ env.FEDORA_VERSION }}-x86_64 --init
- name: Install required packages
run: |
mock -r fedora-${{ env.FEDORA_VERSION }}-x86_64 --install lorax-lmc-novirt vim-minimal pykickstart livecd-tools
- name: Copy configuration file to mock
run: |
mock -r fedora-${{ env.FEDORA_VERSION }}-x86_64 --copyin dishes/${{ env.KICKSTART_FILE }} /builddir
- name: Build ISO with livemedia-creator
run: |
mock -r fedora-${{ env.FEDORA_VERSION }}-x86_64 --shell --enable-network --isolation=simple << 'EOF'
cd /builddir
livemedia-creator --ks ${{ env.KICKSTART_FILE }}.cfg --no-virt --resultdir /var/lmc --project ${{ env.KICKSTART_FILE }} --make-iso --volid ${{ env.KICKSTART_FILE }} --iso-only --iso-name ${{ env.KICKSTART_FILE }}-${{ env.FEDORA_VERSION }}.iso --releasever ${{ env.FEDORA_VERSION }} --macboot
EOF
- name: Release
uses: https://git.phyllo.me/devops/action-gh-release@v2
if: github.ref_type == 'tag'
with:
files: /var/lib/mock/fedora-${{ env.FEDORA_VERSION }}-x86_64/root/var/lmc/${{ env.KICKSTART_FILE }}-${{ env.FEDORA_VERSION }}.iso
draft: false
prerelease: false
- name: Cleanup mock environment
if: always()
run: |
mock -r fedora-${{ env.FEDORA_VERSION }}-x86_64 --clean
+38
View File
@@ -0,0 +1,38 @@
name: container-tests
on:
push:
paths:
- 'tests/**/*.py'
- 'tests/container/**'
pull_request:
paths:
- 'tests/**/*.py'
jobs:
test:
runs-on: fedora
container:
image: git.phyllo.me/devops/fedora-runner-image:latest
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Build test container
run: |
cd scripts
podman build -t phyllo/test-runner ../tests/container/
- name: Run tests in container
run: |
podman run --rm -v $(pwd):/phyllomeos:ro phyllo/test-runner
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: container-test-results
path: _pytest_cache/
if-no-files-found: ignore
+51
View File
@@ -0,0 +1,51 @@
name: test-generation
on:
push:
paths:
- 'scripts/**/*.py'
- 'scripts/**/*.yaml'
- 'fragments/**/*.ks'
pull_request:
paths:
- 'scripts/**/*.py'
- 'scripts/**/*.yaml'
jobs:
generate:
runs-on: fedora
container:
image: git.phyllo.me/devops/fedora-runner-image:latest
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Install dependencies
run: |
pip install PyYAML pykickstart
- name: Generate all variants
run: |
cd scripts
python3 generate_recipe.py \
--manifest recipes_manifest.yaml \
--output-dir ../recipes/
- name: Verify 16 recipes created
run: |
count=$(ls recipes/*.cfg | wc -l)
if [ $count -ne 16 ]; then
echo "Expected 16 recipes, got $count"
exit 1
fi
echo "✓ Generated $count recipes"
- name: Upload generated recipes
uses: actions/upload-artifact@v3
with:
name: generated-recipes
path: recipes/
if-no-files-found: error
retention-days: 7
+42
View File
@@ -0,0 +1,42 @@
name: validate-fragments
on:
push:
paths:
- 'fragments/**/*.ks'
pull_request:
paths:
- 'fragments/**/*.ks'
jobs:
validate:
runs-on: fedora
container:
image: git.phyllo.me/devops/fedora-runner-image:latest
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Install pykickstart
run: pip install pykickstart
- name: Validate all fragments
run: |
errors=0
for fragment in $(find fragments -name "*.ks"); do
if python3 -c "
from pykickstart.parser import KickstartParser
from pykickstart.version import makeVersion, DEVEL
parser = KickstartParser(makeVersion(DEVEL))
parser.readKickstart(open('$fragment').read())
" 2>/dev/null; then
echo "✓ $fragment"
else
echo "✗ $fragment"
errors=$((errors + 1))
fi
done
echo "Fragment validation complete: $errors errors"
exit $errors
+50
View File
@@ -0,0 +1,50 @@
name: validate-recipes
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
validate:
runs-on: fedora
container:
image: git.phyllo.me/devops/fedora-runner-image:latest
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Install dependencies
run: |
pip install PyYAML pytest pykickstart
- name: Generate all recipes
run: |
cd scripts
make generate-recipes
- name: Validate recipes (strict mode)
run: |
cd scripts
python3 generate_recipe.py --validate ../recipes/*.cfg --strict
- name: Run unit tests
run: |
cd scripts
make test
- name: Run integration tests
run: |
cd scripts
make test-integration
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: _pytest_cache/
if-no-files-found: ignore