From 8f5f120cbf86880b8512995672524d210ce44af3 Mon Sep 17 00:00:00 2001 From: "Jason N." <33561705+JasonN3@users.noreply.github.com> Date: Wed, 28 Feb 2024 16:40:22 -0500 Subject: [PATCH] test creating disk and files --- .github/workflows/build-and-test.yml | 77 +++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 821dbac..a188b67 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -17,8 +17,30 @@ env: VARIANT: 'Server' jobs: + check-changes: + name: Check Changes + runs-on: ubuntu-latest + outputs: + container: ${{ steps.changes.outputs.container }} + steps: + - uses: actions/checkout@v3 + + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + container: + - 'Containerfile' + - '/lorax_templates/**' + - '/xorriso/**' + - '/Makefile' + - '/entrypoint.sh' + build-container: runs-on: ubuntu-latest + if: needs.check-changes.outputs.container == 'true' + needs: + - check-changes permissions: contents: read packages: write @@ -57,10 +79,13 @@ jobs: build-and-push-iso: runs-on: ubuntu-latest needs: + - check-changes - build-container permissions: contents: read packages: write + outputs: + artifact_url: ${{ steps.upload.outputs.artifact-url }} steps: - name: Checkout repo uses: actions/checkout@v4 @@ -79,7 +104,19 @@ jobs: type=ref,event=branch type=ref,event=pr - - name: Build ISO + - name: Build ISO with new container + if: needs.check-changes.outputs.container == 'true' + uses: ./ + with: + arch: ${{ env.ARCH}} + image_name: ${{ env.IMAGE_NAME}} + image_repo: ${{ env.IMAGE_REPO}} + version: ${{ env.VERSION }} + variant: ${{ env.VARIANT }} + action_version: ${{ steps.meta.outputs.tags }} + + - name: Build ISO with latest container + if: needs.check-changes.outputs.container == 'false' uses: ./ with: arch: ${{ env.ARCH}} @@ -94,6 +131,7 @@ jobs: mv build/deploy.iso build/${{ env.IMAGE_NAME }}-${{ env.VERSION }}.iso - name: Upload ISO as artifact + id: upload uses: actions/upload-artifact@v4 with: name: ${{ env.IMAGE_NAME }}-${{ env.VERSION }}.iso @@ -102,3 +140,40 @@ jobs: retention-days: 0 compression-level: 0 overwrite: true + + test-qemu: + runs-on: ubuntu-latest + needs: + - build-and-push-iso + permissions: + contents: read + packages: write + steps: + - name: Ensure qemu is installed + run: | + apt-get update + apt-get install -y qemu qemu-utils xorriso unzip + + - name: Create disk + run: | + qemu-img create -f qcow2 disk.qcow2 50G + + - name: Add anaconda.ks to ISO + run: | + wget ${{ needs.build-and-push-iso.outputs.artifact_url }} + ls + unzip *.zip + cat << EOF > ks.cfg + + EOF + xorriso -dialog on << EOF + -indev ${{ env.IMAGE_NAME }}-${{ env.VERSION }}.iso + -outdev test.iso + -map ks.cfg ks.cfg + -chmod 0444 ks.cfg + -end + EOF + + #- name: Start a VM + # run: | + # qemu-system-x86_64 --name "Anaconda" -m 4096 -cpu host -cdrom test.iso -drive file=disk.qcow2