name: Build the boxes "on": workflow_dispatch: 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 | jq -cRs 'split("\n") | [ .[] | if length > 0 then . else empty end ]') echo "::set-output name=distros::${distros}" build: name: Build box runs-on: ubuntu-latest needs: - collect strategy: fail-fast: false matrix: distro: ${{ fromJson( needs.collect.outputs.distros ) }} packer_version: - "1.8.0" needs_timeout: - distros/ubuntu-20.04-x86_64.pkrvars.hcl steps: - uses: actions/checkout@v3 with: submodules: 'recursive' - uses: greg-hellings/make-space@main - uses: actions/setup-python@v3 with: python-version: "3" - uses: actions/cache@v3 with: path: ~/.cache/pip key: python-pip - name: install dependencies shell: bash run: | set -e sudo apt-get update sudo apt-get install -y unzip cloud-utils qemu-system-{x86,ppc} python3 -m pip install -U wheel python3 -m pip install -U ansible # Install packer.io curl -O https://releases.hashicorp.com/packer/${{ matrix.packer_version }}/packer_${{ matrix.packer_version }}_linux_amd64.zip unzip packer_${{ matrix.packer_version }}_linux_amd64.zip mv packer packerio chmod +x packerio - name: modify build timeouts, if necessary if: contains(matrix.needs_timeout, matrix.distro) shell: bash run: ./modify_timeout.sh "${{ matrix.distro }}" - name: try build shell: bash run: | set -e ./packerio build -var-file=${{ matrix.distro }} -var "qemu_accelerator=tcg" -except=upload sources env: VAGRANT_CLOUD_TOKEN: ${{ secrets.VAGRANT_CLOUD_TOKEN }} PACKER_LOG: ${{ contains(matrix.needs_timeout, matrix.distro) && '1' || '0' }}