Change from QCow2 to Raw images Update boot options for better outputs Add SSH host key acceptance files Change Ubuntu builder to Ubuntu 22
67 lines
2.0 KiB
YAML
67 lines
2.0 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: ubuntu-22.04
|
|
needs:
|
|
- collect
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
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
|
|
- uses: ./.github/actions/setup
|
|
with:
|
|
ansible: true
|
|
- uses: ./.github/actions/install_packer
|
|
- 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: try 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
|
|
until packer build -var-file="${file}" -var "qemu_accelerator=tcg" ${{ github.event_name != 'release' && '-except=upload' || '' }} sources; do
|
|
sleep 1
|
|
done
|
|
env:
|
|
VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }}
|
|
PACKER_LOG: ${{ contains(matrix.needs_timeout, matrix.distro) && '1' || '1' }}
|