Update build-ova.yml #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build OVF Image | |
| on: | |
| push: | |
| branches: | |
| - ova | |
| workflow_dispatch: | |
| inputs: | |
| core_tag: | |
| description: "defguard core image tag" | |
| required: true | |
| proxy_tag: | |
| description: "defguard proxy image tag" | |
| required: true | |
| gateway_tag: | |
| description: "defguard gateway image tag" | |
| required: true | |
| env: | |
| DEFAULT_TAG: "2.0.0-alpha2" | |
| jobs: | |
| build: | |
| runs-on: [self-hosted, Linux, X64] | |
| defaults: | |
| run: | |
| working-directory: ova | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y --no-install-recommends ovmf | |
| - name: Check KVM availability | |
| run: | | |
| ls -la /dev/kvm | |
| echo "test" | |
| id | |
| [ -r /dev/kvm ] && echo "KVM readable" || echo "KVM NOT readable" | |
| - name: Setup Packer | |
| uses: hashicorp/setup-packer@main | |
| with: | |
| version: latest | |
| - name: Cache ISO | |
| uses: actions/cache@v4 | |
| with: | |
| path: ova/ubuntu-24.04.4-live-server-amd64.iso | |
| key: ubuntu-24.04.4-live-server-amd64-iso | |
| - name: Download ISO (if not cached) | |
| run: | | |
| if [ ! -f ubuntu-24.04.4-live-server-amd64.iso ]; then | |
| curl -fL -o ubuntu-24.04.4-live-server-amd64.iso \ | |
| https://releases.ubuntu.com/24.04.4/ubuntu-24.04.4-live-server-amd64.iso | |
| fi | |
| - name: Packer init | |
| run: packer init defguard.pkr.hcl | |
| - name: Packer build | |
| env: | |
| PACKER_LOG: 1 | |
| run: | | |
| packer build \ | |
| -var "iso_url=file://$PWD/ubuntu-24.04.4-live-server-amd64.iso" \ | |
| -var "core_tag=${{ github.event.inputs.core_tag || env.DEFAULT_TAG }}" \ | |
| -var "proxy_tag=${{ github.event.inputs.proxy_tag || env.DEFAULT_TAG }}" \ | |
| -var "gateway_tag=${{ github.event.inputs.gateway_tag || env.DEFAULT_TAG }}" \ | |
| defguard.pkr.hcl | |
| - name: Print OVA size | |
| run: ls -lh output/defguard/defguard.ova |