From db801efcbb53148d72bb416c0797d71e65a8a41a Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 1 Jun 2022 10:35:22 -0500 Subject: [PATCH] Try to add Rawhide --- .github/workflows/build.yml | 11 +++-- .gitignore | 3 ++ .gitmodules | 4 ++ distros/fedora-rawhide-x86_64.pkrvars.hcl.sh | 45 ++++++++++++++++++++ http/fedora/rawhide | 1 + 5 files changed, 61 insertions(+), 3 deletions(-) create mode 100755 distros/fedora-rawhide-x86_64.pkrvars.hcl.sh create mode 160000 http/fedora/rawhide diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 511ac09..69d8d03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: id: distros run: |- set -eo pipefail - distros=$(ls distros/*.hcl | jq -cRs 'split("\n") | [ .[] | if length > 0 then . else empty end ]') + distros=$(ls distros/*.hcl{,.sh} | jq -cRs 'split("\n") | [ .[] | if length > 0 then . else empty end ]') echo "::set-output name=distros::${distros}" build: @@ -43,13 +43,18 @@ jobs: 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 - ./packer build -var-file=${{ matrix.distro }} -var "qemu_accelerator=tcg" -except=upload sources || \ - ./packer build -var-file=${{ matrix.distro }} -var "qemu_accelerator=tcg" -except=upload sources + ./packer build -var-file="${file}" -var "qemu_accelerator=tcg" -except=upload sources || \ + ./packer build -var-file="${file}" -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' }} diff --git a/.gitignore b/.gitignore index 39e4b7a..795f53b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ output_* *.box *.iso .vagrant + +# Generated distros +distros/fedora-rawhide-*.hcl diff --git a/.gitmodules b/.gitmodules index 4014b79..5e09482 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,7 @@ path = http/fedora/f36 url = https://pagure.io/fedora-kickstarts.git branch = f36 +[submodule "http/fedora/rawhide"] + path = http/fedora/rawhide + url = https://pagure.io/fedora-kickstarts.git + branch = main diff --git a/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh b/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh new file mode 100755 index 0000000..e246579 --- /dev/null +++ b/distros/fedora-rawhide-x86_64.pkrvars.hcl.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +set -exo pipefail + +# Name of the file to write out +name="${0%.sh}" + +# Base URL +fedora=https://download.fedoraproject.org/pub/fedora/linux/development/rawhide/Server/x86_64/iso/ + +# Working directory +tmp="$(mktemp -d)" +listing="${tmp}/listing.html" +checksums="${tmp}/checksums" + +# First, find the proper URL, since it updates every build +curl -L -o "${listing}" "${fedora}" +links="$(cat "${listing}" | pup 'a[href*=".iso"] attr{href}' | grep dvd)" +iso_name="$(echo "${links}" | grep -e 'iso$')" +iso="${fedora}${iso_name}" + +# Read the SHA256 sum value +sums="$(cat "${listing}" | pup 'a[href*="CHECKSUM"] attr{href}')" +until curl -f -L -o "${checksums}" "${fedora}${sums}"; do + sleep 1 +done +sha="$(cat "${checksums}" | grep dvd | grep SHA256 | cut -d' ' -f 4)" + +# Write out HCL file +cat << EOF > "${name}" +distro = "fedora" +arch = "x86_64" +version = "rawhide" +iso = { + url = "${iso}" + checksum = "${sha}" +} +boot_wait = "20s" +boot_command = [ + "", + "edd=off net.ifnames=0 biosdevnames=0 inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/fedora/rawhide-x86_64.ks console=ttyS0" +] +ssh_handshake_attempts = 1000 +EOF + +rm -r "${tmp}" diff --git a/http/fedora/rawhide b/http/fedora/rawhide new file mode 160000 index 0000000..1fcebbb --- /dev/null +++ b/http/fedora/rawhide @@ -0,0 +1 @@ +Subproject commit 1fcebbbe2277184f2bc5963180434fb559d59053