feat: add kvm #1
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: Packer build qemu | |
| on: | |
| push: | |
| branches: | |
| - "feat/add-kvm-acceleration" | |
| jobs: | |
| build: | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: codespaces | |
| steps: | |
| - 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: Debug Print Ref Info | |
| run: | | |
| echo "inputs.glueops_codespace_tag: ${{ inputs.glueops_codespace_tag }}" | |
| echo "event.workflow_run.head_branch: ${{ github.event.workflow_run.head_branch }}" | |
| echo "event.workflow_run.head_sha: ${{ github.event.workflow_run.head_sha }}" | |
| echo "github.ref: ${{ github.ref }}" | |
| echo "event_name: ${{ github.event_name }}" | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ inputs.glueops_codespace_tag || github.event.workflow_run.head_sha }} | |
| - name: Setup packer | |
| uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232 # v3.1.0 | |
| id: setup | |
| with: | |
| version: 1.11.2 | |
| - name: Generate image password | |
| run: echo "IMAGE_PASSWORD=$(openssl rand -base64 16)" >> $GITHUB_ENV | |
| - name: Generate cloud-init data | |
| run: | | |
| echo '#cloud-config | |
| chpasswd: | |
| expire: False | |
| users: | |
| - {name: debian, password: '"$IMAGE_PASSWORD"', type: text} | |
| ssh_pwauth: True' > user-data | |
| echo '' > meta-data | |
| - name: Install qemu | |
| run: sudo apt-get update && sudo apt-get install qemu-system -y | |
| - name: Run packer init | |
| id: init | |
| run: packer init qemu.pkr.hcl | |
| - name: Run packer build | |
| id: build | |
| run: packer build -var glueops_codespaces_container_tag=v0.98.0 -var image_password=${{ env.IMAGE_PASSWORD }} qemu.pkr.hcl |