Files
vms/.github/workflows/build.yml
T
Greg HellingsandGitHub dea5487a3c Add virtualbox-iso target
Lots of other, small quality of life improvements to build process
Output of build serial console to artifacts upon failure
Reducing verbosity of Packer, now that serial output is captured
Fixed sizing problems with the boot partitions of Ubuntu versions
Use of Mac builders for Virtualbox targets
Updating Ubuntu builders to 22.04, as well
2022-06-08 01:39:37 -05:00

77 lines
2.4 KiB
YAML

name: Build the boxes
"on":
workflow_dispatch:
release:
types:
- published
- prereleased
pull_request:
jobs:
collect:
name: Discover distros
runs-on: ubuntu-latest
outputs:
distros: ${{ steps.distros.outputs.distros }}
steps:
- uses: actions/checkout@v3
- name: Discover boxes
id: distros
run: |-
set -eo pipefail
distros=$(ls distros/*.hcl{,.sh} | jq -cRs 'split("\n") | [ .[] | if length > 0 then . else empty end ]')
echo "::set-output name=distros::${distros}"
build:
name: Build box
runs-on: ${{ matrix.builder == 'virtualbox-iso.x86_64' && 'macOS-12' || 'ubuntu-22.04' }}
needs:
- collect
strategy:
fail-fast: false
matrix:
builder:
- virtualbox-iso.x86_64
- qemu.x86_64
distro: ${{ fromJson( needs.collect.outputs.distros ) }}
needs_timeout:
- distros/ubuntu-20.04-x86_64.pkrvars.hcl
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup system dependnecies
uses: ./.github/actions/setup
with:
ansible: true
- name: Install Packer and related tools
uses: ./.github/actions/install_packer
- name: Clear disk space
uses: greg-hellings/make-space@main
- name: Modify build timeouts, if necessary
if: contains(matrix.needs_timeout, matrix.distro)
shell: bash
run: ./modify_timeout.sh "${{ matrix.distro }}"
- name: Run generator, if necessary
if: endsWith(matrix.distro, '.sh')
run: "${{ matrix.distro }}"
- name: Build
shell: bash
run: |
set -e
# Strip .sh if it is a dynamic one
file="$(printf "${{ matrix.distro }}" | sed -E -e 's/^(.*).sh$/\1/')"
# Add a retry in case something bogus like a network failure happens
packer build -only="${{ matrix.builder }}" -var-file="${file}" -var "qemu_accelerator=tcg" ${{ github.event_name != 'release' && '-except=upload' || '' }} sources
env:
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }}
PACKER_LOG: ${{ contains(matrix.needs_timeout, matrix.distro) && '0' || '0' }}
- name: Upload artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: serial-output
path: serial-output*