From 2b80f1c13b8cf50a6b98341062d36a3a900c10a9 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Thu, 23 May 2024 11:56:02 -0500 Subject: [PATCH] setup workflow for hosted runners (#1547) * setup workflow for hosted runners --- .github/workflows/ci-build.yml | 4 + .github/workflows/pkr-bld-amazonlinux-x64.yml | 6 +- .github/workflows/pkr-bld-hyperv-x64.yml | 48 +++--- .github/workflows/pkr-bld-parallels-arm64.yml | 5 +- .github/workflows/pkr-bld-parallels-x64.yml | 5 +- .github/workflows/pkr-bld-qemu-arm64.yml | 11 +- .github/workflows/pkr-bld-qemu-x64.yml | 10 +- .../workflows/pkr-bld-virtualbox-arm64.yml | 14 +- .github/workflows/pkr-bld-virtualbox-x64.yml | 15 +- .github/workflows/pkr-bld-vmware-arm64.yml | 147 +++++++++++++++--- .github/workflows/pkr-bld-vmware-x64.yml | 146 +++++++++++++++-- .github/workflows/test-pkr-bld-parallels.yml | 145 +++++++++++++++++ CHANGELOG.md | 42 +++-- README.md | 1 + amazonlinux-2-x86_64-virtualbox-build.sh | 2 +- amazonlinux-2023-aarch64-virtualbox-build.sh | 2 +- amazonlinux-2023-x86_64-virtualbox-build.sh | 2 +- bento.gemspec | 2 - builds.yml | 8 +- lib/bento/runner.rb | 2 +- lib/bento/upload.rb | 9 ++ lib/bento/version.rb | 2 +- .../almalinux/almalinux-9-aarch64.pkrvars.hcl | 4 +- .../almalinux/almalinux-9-x86_64.pkrvars.hcl | 4 +- .../centos/centos-7-aarch64.pkrvars.hcl | 9 -- os_pkrvars/centos/centos-7-x86_64.pkrvars.hcl | 9 -- .../centos-stream-8-aarch64.pkrvars.hcl | 9 -- .../centos/centos-stream-8-x86_64.pkrvars.hcl | 9 -- .../oraclelinux-7-aarch64.pkrvars.hcl | 9 -- .../oraclelinux-7-x86_64.pkrvars.hcl | 9 -- .../oraclelinux-9-aarch64.pkrvars.hcl | 6 +- .../oraclelinux-9-x86_64.pkrvars.hcl | 6 +- os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl | 9 -- os_pkrvars/rhel/rhel-7-x86_64.pkrvars.hcl | 9 -- os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl | 2 +- os_pkrvars/rhel/rhel-9-x86_64.pkrvars.hcl | 2 +- .../rockylinux-9-aarch64.pkrvars.hcl | 4 +- .../rockylinux-9-x86_64.pkrvars.hcl | 4 +- packer_templates/http/ubuntu/user-data | 9 +- packer_templates/pkr-builder.pkr.hcl | 5 +- packer_templates/pkr-sources.pkr.hcl | 31 ++-- packer_templates/pkr-variables.pkr.hcl | 18 ++- 42 files changed, 567 insertions(+), 228 deletions(-) create mode 100644 .github/workflows/test-pkr-bld-parallels.yml delete mode 100644 os_pkrvars/centos/centos-7-aarch64.pkrvars.hcl delete mode 100644 os_pkrvars/centos/centos-7-x86_64.pkrvars.hcl delete mode 100644 os_pkrvars/centos/centos-stream-8-aarch64.pkrvars.hcl delete mode 100644 os_pkrvars/centos/centos-stream-8-x86_64.pkrvars.hcl delete mode 100644 os_pkrvars/oraclelinux/oraclelinux-7-aarch64.pkrvars.hcl delete mode 100644 os_pkrvars/oraclelinux/oraclelinux-7-x86_64.pkrvars.hcl delete mode 100644 os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl delete mode 100644 os_pkrvars/rhel/rhel-7-x86_64.pkrvars.hcl diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 4caf23c95..783a4d1ed 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -95,3 +95,7 @@ jobs: allowed-failures: allowed-skips: ${{ toJSON(needs) }} jobs: ${{ toJSON(needs) }} + +# pkr-bld-parallels-test: +# uses: ./.github/workflows/test-pkr-bld-parallels.yml +# secrets: inherit diff --git a/.github/workflows/pkr-bld-amazonlinux-x64.yml b/.github/workflows/pkr-bld-amazonlinux-x64.yml index e12c54d14..111cbeb33 100644 --- a/.github/workflows/pkr-bld-amazonlinux-x64.yml +++ b/.github/workflows/pkr-bld-amazonlinux-x64.yml @@ -4,7 +4,7 @@ on: env: PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + # PACKER_LOG: "1" jobs: x86_64: @@ -28,6 +28,8 @@ jobs: vagrant --version - name: Install Chef uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 - name: Setup Packer uses: hashicorp/setup-packer@main with: @@ -46,6 +48,7 @@ jobs: sudo chmod -R 777 /mnt/builds sudo ln -s /mnt/builds ./ eval "$(chef shell-init bash)" + export LOGNAME=$USER ./${{ matrix.os }}-x86_64-virtualbox-build.sh ls -alh builds cat builds/${{ matrix.os }}*-x86_64._metadata.json @@ -61,4 +64,5 @@ jobs: - name: Bento Test run: | eval "$(chef shell-init bash)" + export LOGNAME=$USER bento test diff --git a/.github/workflows/pkr-bld-hyperv-x64.yml b/.github/workflows/pkr-bld-hyperv-x64.yml index 7002d7f76..4c2121d7c 100644 --- a/.github/workflows/pkr-bld-hyperv-x64.yml +++ b/.github/workflows/pkr-bld-hyperv-x64.yml @@ -4,28 +4,25 @@ on: env: PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + # PACKER_LOG: "1" jobs: x86_64: - runs-on: [self-hosted, X64, hyperv] + runs-on: windows-latest strategy: fail-fast: false matrix: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 - - fedora-38 - fedora-39 + - fedora-40 - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 @@ -38,20 +35,29 @@ jobs: steps: - name: Checkout uses: actions/checkout@main -# - name: Setup Packer -# uses: hashicorp/setup-packer@main -# with: -# version: latest - - name: Bento build - run: packer build -timestamp-ui -only="${{ matrix.provider }}.vm" -var-file="os_pkrvars/$("${{ matrix.os }}".Split('-')[0])/${{ matrix.os }}-x86_64.pkrvars.hcl" packer_templates - - name: Remove VM in case of canceled job - if: cancelled() + - name: Install Chef + uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 + - name: Setup Packer + uses: hashicorp/setup-packer@main + with: + version: latest + - name: Install Bento run: | - echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-amd64 - Stop-VM -Force ${{ matrix.os }}*-amd64 - sleep 1 - Remove-VM -Force ${{ matrix.os }}*-amd64 - sleep 2 + chef shell-init powershell + gem build bento.gemspec + gem install bento-*.gem + - name: Create VM Switch for Hyper-V + shell: pwsh + run: | + Get-PsDrive -PsProvider FileSystem + pwd + New-VMSwitch -Name "bento" -NetAdapterName "Ethernet" -AllowManagementOS $true + - name: Packer Init + run: packer init -upgrade packer_templates + - name: Packer build + run: packer build -timestamp-ui -only="${{ matrix.provider }}.vm" -var 'sources_enabled=["hyperv-iso.vm"]' -var-file="os_pkrvars/$("${{ matrix.os }}".Split('-')[0])/${{ matrix.os }}-x86_64.pkrvars.hcl" packer_templates - name: Upload build artifact uses: actions/upload-artifact@main with: @@ -61,3 +67,7 @@ jobs: builds/*.json retention-days: 10 compression-level: 0 # no compression + - name: Bento Test + run: | + chef shell-init powershell + bento test diff --git a/.github/workflows/pkr-bld-parallels-arm64.yml b/.github/workflows/pkr-bld-parallels-arm64.yml index 6934da07f..be31c1e6c 100644 --- a/.github/workflows/pkr-bld-parallels-arm64.yml +++ b/.github/workflows/pkr-bld-parallels-arm64.yml @@ -4,7 +4,7 @@ on: env: PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + # PACKER_LOG: "1" jobs: aarch64: @@ -15,8 +15,6 @@ jobs: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -25,7 +23,6 @@ jobs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 diff --git a/.github/workflows/pkr-bld-parallels-x64.yml b/.github/workflows/pkr-bld-parallels-x64.yml index 9af99ba4c..a2836e92b 100644 --- a/.github/workflows/pkr-bld-parallels-x64.yml +++ b/.github/workflows/pkr-bld-parallels-x64.yml @@ -4,7 +4,7 @@ on: env: PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + # PACKER_LOG: "1" jobs: x86_64: @@ -15,8 +15,6 @@ jobs: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -25,7 +23,6 @@ jobs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 diff --git a/.github/workflows/pkr-bld-qemu-arm64.yml b/.github/workflows/pkr-bld-qemu-arm64.yml index 944f8c95f..0213abdd6 100644 --- a/.github/workflows/pkr-bld-qemu-arm64.yml +++ b/.github/workflows/pkr-bld-qemu-arm64.yml @@ -8,15 +8,13 @@ env: jobs: aarch64: - runs-on: macos-14 + runs-on: macos-latest strategy: fail-fast: false matrix: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -25,7 +23,6 @@ jobs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 @@ -40,13 +37,17 @@ jobs: uses: actions/checkout@main - name: Install Vagrant QEMU run: | - brew install qemu libvirt brew tap hashicorp/tap + brew update + brew install qemu + brew install libvirt brew install --cask hashicorp/tap/hashicorp-vagrant brew services start libvirt vagrant plugin install vagrant-libvirt vagrant-qemu - name: Install Chef uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 - name: Setup Packer uses: hashicorp/setup-packer@main with: diff --git a/.github/workflows/pkr-bld-qemu-x64.yml b/.github/workflows/pkr-bld-qemu-x64.yml index 5bb0eee9b..729343d38 100644 --- a/.github/workflows/pkr-bld-qemu-x64.yml +++ b/.github/workflows/pkr-bld-qemu-x64.yml @@ -4,7 +4,7 @@ on: env: PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + # PACKER_LOG: "1" jobs: x86_64: @@ -15,8 +15,6 @@ jobs: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -25,7 +23,6 @@ jobs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 @@ -38,14 +35,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@main - - name: Install Vagrant and kvm + - name: Install Vagrant QEMU run: | wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt-get update sudo apt-get install -y software-properties-common vagrant qemu-kvm libvirt-daemon-system virtinst libvirt-clients bridge-utils qemu-utils libvirt-dev vagrant plugin install vagrant-libvirt vagrant-qemu - vagrant --version - name: Enable KVM run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules @@ -58,6 +54,8 @@ jobs: sudo systemctl status libvirtd - name: Install Chef uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 - name: Setup Packer uses: hashicorp/setup-packer@main with: diff --git a/.github/workflows/pkr-bld-virtualbox-arm64.yml b/.github/workflows/pkr-bld-virtualbox-arm64.yml index d649e759c..f1e9450d9 100644 --- a/.github/workflows/pkr-bld-virtualbox-arm64.yml +++ b/.github/workflows/pkr-bld-virtualbox-arm64.yml @@ -4,19 +4,17 @@ on: env: PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + # PACKER_LOG: "1" jobs: aarch64: - runs-on: macos-14 + runs-on: macos-latest strategy: fail-fast: false matrix: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -25,7 +23,6 @@ jobs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 @@ -41,12 +38,13 @@ jobs: - name: Install Vagrant Virtualbox run: | brew tap hashicorp/tap + brew update brew install --cask hashicorp/tap/hashicorp-vagrant - wget -q https://www.virtualbox.org/download/testcase/VirtualBox-7.0.15_BETA4-162549-macOSArm64.dmg - hdiutil attach VirtualBox-7.0.15_BETA4-162549-macOSArm64.dmg - sudo installer -pkg /Volumes/VirtualBox/VirtualBox.pkg -target / + brew install --cask virtualbox@beta - name: Install Chef uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 - name: Setup Packer uses: hashicorp/setup-packer@main with: diff --git a/.github/workflows/pkr-bld-virtualbox-x64.yml b/.github/workflows/pkr-bld-virtualbox-x64.yml index 2aafba2ae..e1d52132a 100644 --- a/.github/workflows/pkr-bld-virtualbox-x64.yml +++ b/.github/workflows/pkr-bld-virtualbox-x64.yml @@ -3,8 +3,8 @@ on: workflow_call: env: - PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # PACKER_LOG: 1 jobs: x86_64: @@ -15,8 +15,6 @@ jobs: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -25,7 +23,6 @@ jobs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 @@ -38,7 +35,7 @@ jobs: steps: - name: Checkout uses: actions/checkout@main - - name: Install Vagrant and VirtualBox + - name: Install Vagrant VirtualBox run: | wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | gpg --dearmor | sudo tee /usr/share/keyrings/oracle-virtualbox-2016.gpg @@ -46,10 +43,10 @@ jobs: echo "deb [signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list sudo apt-get update sudo apt-get install -y software-properties-common vagrant virtualbox-7.0 - VBoxManage --version - vagrant --version - name: Install Chef uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 - name: Setup Packer uses: hashicorp/setup-packer@main with: @@ -66,6 +63,7 @@ jobs: sudo chmod -R 777 /mnt/builds sudo ln -s /mnt/builds ./ eval "$(chef shell-init bash)" + export LOGNAME=$USER bento build -o ${{ matrix.provider }}.vm os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" ls -alh builds/ cat builds/${{ matrix.os }}*-x86_64._metadata.json @@ -81,4 +79,5 @@ jobs: - name: Bento Test run: | eval "$(chef shell-init bash)" + export LOGNAME=$USER bento test diff --git a/.github/workflows/pkr-bld-vmware-arm64.yml b/.github/workflows/pkr-bld-vmware-arm64.yml index 567e56ccd..e4f0a66fa 100644 --- a/.github/workflows/pkr-bld-vmware-arm64.yml +++ b/.github/workflows/pkr-bld-vmware-arm64.yml @@ -4,19 +4,17 @@ on: env: PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + # PACKER_LOG: "1" jobs: aarch64: - runs-on: [self-hosted, ARM64, vmware-fusion] + runs-on: macos-latest strategy: fail-fast: false matrix: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -25,7 +23,6 @@ jobs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 @@ -38,25 +35,139 @@ jobs: steps: - name: Checkout uses: actions/checkout@main -# - name: Setup Packer -# if: steps.verify-changed-files.outputs.files_changed == 'true' -# uses: hashicorp/setup-packer@main -# with: -# version: latest + - name: Install Vagrant VMware-fusion + run: | + brew tap hashicorp/tap + brew update + brew install --cask hashicorp/tap/hashicorp-vagrant + brew install --cask vmware-fusion + brew install --cask vagrant-vmware-utility + vagrant plugin install vagrant-vmware-desktop + sudo mkdir -p /Library/Preferences/VMware\ Fusion/vmnet8 + NETWORKING_CONF="/Library/Preferences/VMware Fusion/networking" + DHCPD_CONF="/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf" + NAT_CONF="/Library/Preferences/VMware Fusion/vmnet8/nat.conf" + NAT_MAC_CONF="/Library/Preferences/VMware Fusion/vmnet8/nat.mac" + DHCPD_CONFIG=' + # Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8. + + ###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" ##### + # Modification Instructions: This section of the configuration file contains + # information generated by the configuration program. Do not modify this + # section. + + # Written at: 05/20/2024 11:50:44 + allow unknown-clients; + default-lease-time 1800; # default is 30 minutes + max-lease-time 7200; # default is 2 hours + + subnet 172.16.38.0 netmask 255.255.255.0 { + range 172.16.38.128 172.16.38.254; + option broadcast-address 172.16.38.255; + option domain-name-servers 172.16.38.2; + option domain-name localdomain; + default-lease-time 1800; # default is 30 minutes + max-lease-time 7200; # default is 2 hours + option netbios-name-servers 172.16.38.2; + option routers 172.16.38.2; + } + host vmnet8 { + hardware ethernet 00:50:56:C0:00:08; + fixed-address 172.16.38.1; + option domain-name-servers 0.0.0.0; + option domain-name ""; + option routers 0.0.0.0; + } + ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" ####### + ' + NAT_CONFIG=" + # VMware NAT configuration file + [host] + # Use MacOS network virtualization API + useMacosVmnetVirtApi = 1 + # NAT gateway address + ip = 172.16.38.2 + netmask = 255.255.255.0 + # VMnet device if not specified on command line + device = vmnet8 + # Allow PORT/EPRT FTP commands (they need incoming TCP stream ...) + activeFTP = 1 + # Allows the source to have any OUI. Turn this on if you change the OUI in the MAC address of your virtual machines. + allowAnyOUI = 1 + # VMnet host IP address + hostIp = 172.16.38.1 + # Controls if (TCP) connections should be reset when the adapter they are bound to goes down + resetConnectionOnLinkDown = 1 + # Controls if (TCP) connection should be reset when guest packet's destination is NAT's IP address + resetConnectionOnDestLocalHost = 1 + # Controls if enable nat ipv6 + natIp6Enable = 0 + # Controls if enable nat ipv6 + natIp6Prefix = fd15:4ba5:5a2b:1008::/64 + [tcp] + # Value of timeout in TCP TIME_WAIT state, in seconds + timeWaitTimeout = 30 + [udp] + # Timeout in seconds. Dynamically-created UDP mappings will purged if idle for this duration of time 0 = no timeout, default = 60; real value might be up to 100% longer + timeout = 60 + [netbios] + # Timeout for NBNS queries. + nbnsTimeout = 2 + # Number of retries for each NBNS query. + nbnsRetries = 3 + # Timeout for NBDS queries. + nbdsTimeout = 3 + [incomingtcp] + # Use these with care - anyone can enter into your VM through these... + # The format and example are as follows: + # = : + #8080 = 172.16.3.128:80 + [incomingudp] + # UDP port forwarding example + #6000 = 172.16.3.0:6001 + " + NAT_MAC_CONFIG="00:50:56:F2:C7:28" + NETWORKING_CONFIG=" + VERSION=1,0 + answer VNET_1_DHCP yes + answer VNET_1_DHCP_CFG_HASH 97D56988968565698E051056ADEDEEACF00F5981 + answer VNET_1_HOSTONLY_NETMASK 255.255.255.0 + answer VNET_1_HOSTONLY_SUBNET 172.16.252.0 + answer VNET_1_HOSTONLY_UUID 74A7B7F5-AB8E-41CF-9E0F-595F9C9FA1C5 + answer VNET_1_VIRTUAL_ADAPTER yes + answer VNET_8_DHCP yes + answer VNET_8_DHCP_CFG_HASH 2040265D0F7053A921FB3F6EDE944490D9E687D6 + answer VNET_8_HOSTONLY_NETMASK 255.255.255.0 + answer VNET_8_HOSTONLY_SUBNET 172.16.38.0 + answer VNET_8_HOSTONLY_UUID 3CBAC6B3-6A71-4182-8BC6-849058A947B8 + answer VNET_8_NAT yes + answer VNET_8_VIRTUAL_ADAPTER yes + " + # Write the network configuration to the file + echo "$NETWORKING_CONFIG" | sudo tee "$NETWORKING_CONF" > /dev/null + echo "$DHCPD_CONFIG" | sudo tee "$DHCPD_CONF" > /dev/null + echo "$NAT_CONFIG" | sudo tee "$NAT_CONF" > /dev/null + echo "$NAT_MAC_CONFIG" | sudo tee "$NAT_MAC_CONF" > /dev/null + echo "VMware Fusion networking configuration updated." + - name: Install Chef + uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 + - name: Setup Packer + uses: hashicorp/setup-packer@main + with: + version: latest + - name: Install Bento + run: | + eval "$(chef shell-init bash)" + gem build bento.gemspec + gem install bento-*.gem - name: Bento build run: | eval "$(chef shell-init bash)" bento build -o ${{ matrix.provider }}.vm os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-aarch64.pkrvars.hcl" ls -alh builds/ cat builds/${{ matrix.os }}*-aarch64._metadata.json - - name: Remove VM in case of canceled job - if: cancelled() - run: | - echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-aarch64 - vmrun -T fusion stop builds/packer-${{ matrix.os }}*-x86_64-vmware/${{ matrix.os }}*-aarch64.vmx hard 2> /dev/null - sleep 1 - vmrun -T fusion deleteVM builds/packer-${{ matrix.os }}*-x86_64-vmware/${{ matrix.os }}*-aarch64.vmx 2> /dev/null - sleep 2 - name: Upload build artifact uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/pkr-bld-vmware-x64.yml b/.github/workflows/pkr-bld-vmware-x64.yml index 71a95f361..97dc27ff3 100644 --- a/.github/workflows/pkr-bld-vmware-x64.yml +++ b/.github/workflows/pkr-bld-vmware-x64.yml @@ -4,19 +4,17 @@ on: env: PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - PACKER_LOG: "1" + # PACKER_LOG: "1" jobs: x86_64: - runs-on: [self-hosted, X64, vmware-fusion] + runs-on: macos-13 strategy: fail-fast: false matrix: os: - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -25,7 +23,6 @@ jobs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 @@ -38,24 +35,139 @@ jobs: steps: - name: Checkout uses: actions/checkout@main -# - name: Setup Packer -# uses: hashicorp/setup-packer@main -# with: -# version: latest + - name: Install Vagrant VMware-fusion + run: | + brew tap hashicorp/tap + brew update + brew install --cask hashicorp/tap/hashicorp-vagrant + brew install --cask vmware-fusion + brew install --cask vagrant-vmware-utility + vagrant plugin install vagrant-vmware-desktop + sudo mkdir -p /Library/Preferences/VMware\ Fusion/vmnet8 + NETWORKING_CONF="/Library/Preferences/VMware Fusion/networking" + DHCPD_CONF="/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf" + NAT_CONF="/Library/Preferences/VMware Fusion/vmnet8/nat.conf" + NAT_MAC_CONF="/Library/Preferences/VMware Fusion/vmnet8/nat.mac" + DHCPD_CONFIG=' + # Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8. + + ###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" ##### + # Modification Instructions: This section of the configuration file contains + # information generated by the configuration program. Do not modify this + # section. + + # Written at: 05/20/2024 11:50:44 + allow unknown-clients; + default-lease-time 1800; # default is 30 minutes + max-lease-time 7200; # default is 2 hours + + subnet 172.16.38.0 netmask 255.255.255.0 { + range 172.16.38.128 172.16.38.254; + option broadcast-address 172.16.38.255; + option domain-name-servers 172.16.38.2; + option domain-name localdomain; + default-lease-time 1800; # default is 30 minutes + max-lease-time 7200; # default is 2 hours + option netbios-name-servers 172.16.38.2; + option routers 172.16.38.2; + } + host vmnet8 { + hardware ethernet 00:50:56:C0:00:08; + fixed-address 172.16.38.1; + option domain-name-servers 0.0.0.0; + option domain-name ""; + option routers 0.0.0.0; + } + ####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" ####### + ' + NAT_CONFIG=" + # VMware NAT configuration file + [host] + # Use MacOS network virtualization API + useMacosVmnetVirtApi = 1 + # NAT gateway address + ip = 172.16.38.2 + netmask = 255.255.255.0 + # VMnet device if not specified on command line + device = vmnet8 + # Allow PORT/EPRT FTP commands (they need incoming TCP stream ...) + activeFTP = 1 + # Allows the source to have any OUI. Turn this on if you change the OUI in the MAC address of your virtual machines. + allowAnyOUI = 1 + # VMnet host IP address + hostIp = 172.16.38.1 + # Controls if (TCP) connections should be reset when the adapter they are bound to goes down + resetConnectionOnLinkDown = 1 + # Controls if (TCP) connection should be reset when guest packet's destination is NAT's IP address + resetConnectionOnDestLocalHost = 1 + # Controls if enable nat ipv6 + natIp6Enable = 0 + # Controls if enable nat ipv6 + natIp6Prefix = fd15:4ba5:5a2b:1008::/64 + [tcp] + # Value of timeout in TCP TIME_WAIT state, in seconds + timeWaitTimeout = 30 + [udp] + # Timeout in seconds. Dynamically-created UDP mappings will purged if idle for this duration of time 0 = no timeout, default = 60; real value might be up to 100% longer + timeout = 60 + [netbios] + # Timeout for NBNS queries. + nbnsTimeout = 2 + # Number of retries for each NBNS query. + nbnsRetries = 3 + # Timeout for NBDS queries. + nbdsTimeout = 3 + [incomingtcp] + # Use these with care - anyone can enter into your VM through these... + # The format and example are as follows: + # = : + #8080 = 172.16.3.128:80 + [incomingudp] + # UDP port forwarding example + #6000 = 172.16.3.0:6001 + " + NAT_MAC_CONFIG="00:50:56:F2:C7:28" + NETWORKING_CONFIG=" + VERSION=1,0 + answer VNET_1_DHCP yes + answer VNET_1_DHCP_CFG_HASH 97D56988968565698E051056ADEDEEACF00F5981 + answer VNET_1_HOSTONLY_NETMASK 255.255.255.0 + answer VNET_1_HOSTONLY_SUBNET 172.16.252.0 + answer VNET_1_HOSTONLY_UUID 74A7B7F5-AB8E-41CF-9E0F-595F9C9FA1C5 + answer VNET_1_VIRTUAL_ADAPTER yes + answer VNET_8_DHCP yes + answer VNET_8_DHCP_CFG_HASH 2040265D0F7053A921FB3F6EDE944490D9E687D6 + answer VNET_8_HOSTONLY_NETMASK 255.255.255.0 + answer VNET_8_HOSTONLY_SUBNET 172.16.38.0 + answer VNET_8_HOSTONLY_UUID 3CBAC6B3-6A71-4182-8BC6-849058A947B8 + answer VNET_8_NAT yes + answer VNET_8_VIRTUAL_ADAPTER yes + " + # Write the network configuration to the file + echo "$NETWORKING_CONFIG" | sudo tee "$NETWORKING_CONF" > /dev/null + echo "$DHCPD_CONFIG" | sudo tee "$DHCPD_CONF" > /dev/null + echo "$NAT_CONFIG" | sudo tee "$NAT_CONF" > /dev/null + echo "$NAT_MAC_CONFIG" | sudo tee "$NAT_MAC_CONF" > /dev/null + echo "VMware Fusion networking configuration updated." + - name: Install Chef + uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 + - name: Setup Packer + uses: hashicorp/setup-packer@main + with: + version: latest + - name: Install Bento + run: | + eval "$(chef shell-init bash)" + gem build bento.gemspec + gem install bento-*.gem - name: Bento build run: | eval "$(chef shell-init bash)" bento build -o ${{ matrix.provider }}.vm os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" ls -alh builds/ cat builds/${{ matrix.os }}*-x86_64._metadata.json - - name: Remove VM in case of canceled job - if: cancelled() - run: | - echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-amd64 - vmrun -T fusion stop builds/packer-${{ matrix.os }}*-x86_64-vmware/${{ matrix.os }}*-amd64.vmx hard 2> /dev/null - sleep 1 - vmrun -T fusion deleteVM builds/packer-${{ matrix.os }}*-x86_64-vmware/${{ matrix.os }}*-amd64.vmx 2> /dev/null - sleep 2 - name: Upload build artifact uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/test-pkr-bld-parallels.yml b/.github/workflows/test-pkr-bld-parallels.yml new file mode 100644 index 000000000..53ae3a969 --- /dev/null +++ b/.github/workflows/test-pkr-bld-parallels.yml @@ -0,0 +1,145 @@ +--- +on: + workflow_call: + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + +jobs: + x86_64: + runs-on: macos-13 + strategy: + fail-fast: false + matrix: + os: + - almalinux-8 + - almalinux-9 + - centos-stream-9 + - debian-11 + - debian-12 + - fedora-39 + - fedora-40 + - freebsd-13 + - freebsd-14 + - opensuse-leap-15 + - oraclelinux-8 + - oraclelinux-9 + - rockylinux-8 + - rockylinux-9 + - ubuntu-20.04 + - ubuntu-22.04 + - ubuntu-24.04 + provider: + - parallels-iso + steps: + - name: Checkout + uses: actions/checkout@main + - name: Install Vagrant Parallels + run: | + brew tap hashicorp/tap + brew update + brew install --cask hashicorp/tap/hashicorp-vagrant + brew install --cask parallels + brew install --cask parallels-virtualization-sdk + vagrant plugin install vagrant-parallels + - name: Install Chef + uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 + - name: Setup Packer + uses: hashicorp/setup-packer@main + with: + version: latest + - name: Install Bento + run: | + eval "$(chef shell-init bash)" + gem build bento.gemspec + gem install bento-*.gem + - name: Bento build + run: | + eval "$(chef shell-init bash)" + bento build -o ${{ matrix.provider }}.vm os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" + ls -alh builds/ + cat builds/${{ matrix.os }}*-x86_64._metadata.json + - name: Upload build artifact + uses: actions/upload-artifact@v3 + with: + name: "${{ matrix.os }}-parallels-x86_64" + path: | + builds/*.box + builds/*.json + retention-days: 10 + compression-level: 0 # no compression + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test + + aarch64: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + os: + - almalinux-8 + - almalinux-9 + - centos-stream-9 + - debian-11 + - debian-12 + - fedora-39 + - fedora-40 + - freebsd-13 + - freebsd-14 + - opensuse-leap-15 + - oraclelinux-8 + - oraclelinux-9 + - rockylinux-8 + - rockylinux-9 + - ubuntu-20.04 + - ubuntu-22.04 + - ubuntu-24.04 + provider: + - parallels-iso + steps: + - name: Checkout + uses: actions/checkout@main + - name: Install Vagrant Parallels + run: | + brew tap hashicorp/tap + brew update + brew install --cask hashicorp/tap/hashicorp-vagrant + brew install --cask parallels + brew install --cask parallels-virtualization-sdk + vagrant plugin install vagrant-parallels + - name: Install Chef + uses: actionshub/chef-install@3.0.0 + with: + version: 24.2.1058 + - name: Setup Packer + uses: hashicorp/setup-packer@main + with: + version: latest + - name: Install Bento + run: | + eval "$(chef shell-init bash)" + gem build bento.gemspec + gem install bento-*.gem + - name: Bento build + run: | + eval "$(chef shell-init bash)" + bento build -o ${{ matrix.provider }}.vm os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-aarch64.pkrvars.hcl" + ls -alh builds/ + cat builds/${{ matrix.os }}*-aarch64._metadata.json + - name: Upload build artifact + uses: actions/upload-artifact@v3 + with: + name: "${{ matrix.os }}-parallels-aarch64" + path: | + builds/*.box + builds/*.json + retention-days: 10 + compression-level: 0 # no compression + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a3583a05..b8a2f9fe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,35 +7,31 @@ Markdown table generated at | os | hyperv
x86_64 | parallels
x86_64 | parallels
aarch64 | qemu
x86_64 | qemu
aarch64 | virtualbox
x86_64 | virtualbox
aarch64 | vmware
x86_64 | vmware
aarch64 | |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| -| almalinux-8 | | x | | | | x | | x | | -| almalinux-9 | | x | | | | x | | x | x | +| almalinux-8 | | x | | x | | x | | x | | +| almalinux-9 | | x | x | | | x | | x | x | | amazonlinux-2 | | | | | | x | | | | | amazonlinux-2023 | | | | | | x | | | | -| centos-7 | | | | | | x | | x | | -| centos-stream-8 | | x | | | | x | | x | | | centos-stream-9 | | x | | | | x | | x | x | | debian-11 | | x | x | | | x | | x | | | debian-12 | | x | x | | | x | | x | x | -| fedora-39 | | x | x | | | x | | x | x | -| fedora-40 | | | | | | | | | | +| fedora-39 | | x | x | x | | x | | x | x | +| fedora-40 | | x | | x | | x | | x | x | | freebsd-13 | | | | | | x | | x | x | | freebsd-14 | | | | | | | | | | | macos | | | x | | | | | | | -| opensuse-leap-15 | | | | | | x | | x | x | -| oraclelinux-7 | | x | | | | x | | x | | +| opensuse-leap-15 | | | | x | | x | | x | x | | oraclelinux-8 | | | | | | x | | x | | | oraclelinux-9 | | x | x | | | x | | x | x | -| rhel-7 | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | | rhel-8 | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | | rhel-9 | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | license
needed | -| rockylinux-8 | | x | | | | x | | x | | +| rockylinux-8 | | x | | x | | x | | x | | | rockylinux-9 | | x | | | | x | | x | x | | sles-12 | license
needed | license
needed | na | license
needed | na | license
needed | na | license
needed | na | | sles-15 | license
needed | license
needed | na | license
needed | na | license
needed | na | license
needed | na | | solaris-11 | license
needed | license
needed | na | license
needed | na | license
needed | na | license
needed | na | | ubuntu-20.04 | | | x | | | x | | x | x | | ubuntu-22.04 | | x | | | | x | | | | -| ubuntu-24.04 | | x | x | | | x | | x | x | +| ubuntu-24.04 | | x | x | x | | x | | x | x | | windows-10 | | | na | | na | x | na | | na | | windows-11 | | x | x | | | x | | x | | | windows-2016 | | x | na | | na | x | na | x | na | @@ -45,16 +41,30 @@ Markdown table generated at ### Todo - Fix failing builds -- migrate from http directory for hosting files to floppy_files or cd_files in source templates +- migrate from http directory for hosting files to cd_files in source templates - This makes all builds compatible with hyper-v gen 2 which removes floppy disk capability - - This also makes things universal for Virtualbox 6.1 to 7.x due to latter requiring extra config for guests on NAT to be able to connect to host - - Also eliminates any potential networking issues + - Eliminates any potential networking issues - Update pipelines to only run on updated pkrvars files -- Look into making all build uefi default builds +- Look into making all builds uefi default builds - Create CD pipeline to upload vagrant boxes after PR is merged - Create CD pipeline to build and upload new versions of vagrant boxes once every 3 months with the latest patches -## [unreleased] (2024-04-26) +## [unreleased] (2024-05-23) + +## [v4.1.2] (2024-05-23) + +- Fix for hyper-v build option +- Remove test-kitchen and kitchen-vagrant dependencies from gemspec to fix gem compile error on windows +- Updated hyper-v builds to use github actions hosted runners +- Updated VMware builds to use github actions hosted runners +- Better handle bento uploads of slugs ending in 'latest' +- Fix oraclelinux slug names +- Update almalinux 9.3 to 9.4 +- Update rhel 9.3 to 94 +- Update oraclelinux 9.3 to 9.4 +- Update rockylinux 9.3 to 9.4 +- Remove Centos 7, Centos Stream 8, RHEL 7, Oraclelinux 7 builds due to EOL +- Fix windows qemu args to match disk format when variable is specified ## [v4.1.1] (2024-04-26) diff --git a/README.md b/README.md index d34eb2a4e..5d25ec903 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Bento is a project that encapsulates [Packer](https://www.packer.io/) templates ***NOTE:** - Vagrant 2.4.0+ is required for new cpu architecture support +- For `bento test` command to work test-kitchen and kitchen-vagrant gems must be installed - Virutalbox 6.x requires disabling nat config that allows vbox 7.x guests to connect to the host. To use comment out lines #161 and #162 in bento/packer_templates/pkr-variables.pkr.hcl or add variable `vboxmanage = []` to os_pkrvars files. - When running packer build command the output directory is relative to the working directory the command is currently running in. Suggest running packer build commands from bento root directory for build working files to be placed in bento/builds/(build_name) directory by default. If the output_directory variable isn't overwritten a directory called builds/(build_name) will be created in the current working directory that you are running the command from diff --git a/amazonlinux-2-x86_64-virtualbox-build.sh b/amazonlinux-2-x86_64-virtualbox-build.sh index b7d8e0775..213346346 100755 --- a/amazonlinux-2-x86_64-virtualbox-build.sh +++ b/amazonlinux-2-x86_64-virtualbox-build.sh @@ -71,7 +71,7 @@ vboxmanage unregistervm $VM --delete echo starting packer build of amazonlinux if bento build --vars vbox_source_path="$AMZDIR"/amazon2_x86_64.ovf,vbox_checksum=null "$(pwd)"/os_pkrvars/amazonlinux/amazonlinux-2-x86_64.pkrvars.hcl; then echo "Cleaning up files" - rm -f "$AMZDIR" + rm -rf "$AMZDIR" else exit 1 fi diff --git a/amazonlinux-2023-aarch64-virtualbox-build.sh b/amazonlinux-2023-aarch64-virtualbox-build.sh index bdb1a01e0..0fcc85a1e 100755 --- a/amazonlinux-2023-aarch64-virtualbox-build.sh +++ b/amazonlinux-2023-aarch64-virtualbox-build.sh @@ -80,7 +80,7 @@ vboxmanage unregistervm $VM --delete echo "starting packer build of amazonlinux" if bento build --vars vbox_source_path="$AMZDIR"/amazon2023_arm64.ovf,vbox_checksum=null "$(pwd)"/os_pkrvars/amazonlinux/amazonlinux-2023-aarch64.pkrvars.hcl; then echo "Cleaning up files" - rm -f "$AMZDIR" + rm -rf "$AMZDIR" else exit 1 fi diff --git a/amazonlinux-2023-x86_64-virtualbox-build.sh b/amazonlinux-2023-x86_64-virtualbox-build.sh index da6d3d097..ae3f612c1 100755 --- a/amazonlinux-2023-x86_64-virtualbox-build.sh +++ b/amazonlinux-2023-x86_64-virtualbox-build.sh @@ -78,7 +78,7 @@ vboxmanage unregistervm $VM --delete echo "starting packer build of amazonlinux" if bento build --vars vbox_source_path="$AMZDIR"/amazon2023_x86_64.ovf,vbox_checksum=null "$(pwd)"/os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl; then echo "Cleaning up files" - rm -f "$AMZDIR" + rm -rf "$AMZDIR" else exit 1 fi diff --git a/bento.gemspec b/bento.gemspec index 23dfd1fd0..e90d43c4f 100644 --- a/bento.gemspec +++ b/bento.gemspec @@ -14,8 +14,6 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 3.0' s.add_dependency 'mixlib-shellout', '>= 2.3.2' - s.add_dependency 'test-kitchen' - s.add_dependency 'kitchen-vagrant' s.bindir = 'bin' s.executables = %w(bento) diff --git a/builds.yml b/builds.yml index 373d0b86d..665696e27 100644 --- a/builds.yml +++ b/builds.yml @@ -10,8 +10,6 @@ public: - amazonlinux-2023 - almalinux-8 - almalinux-9 - - centos-7 - - centos-stream-8 - centos-stream-9 - debian-11 - debian-12 @@ -20,7 +18,6 @@ public: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oraclelinux-7 - oraclelinux-8 - oraclelinux-9 - rockylinux-8 @@ -40,9 +37,8 @@ slugs: - freebsd-13 - freebsd-14 - opensuse-leap-15 - - oracle-7 - - oracle-8 - - oracle-9 + - oraclelinux-8 + - oraclelinux-9 - rockylinux-8 - rockylinux-9 - macos-14 diff --git a/lib/bento/runner.rb b/lib/bento/runner.rb index 7c41b5804..b705918d9 100644 --- a/lib/bento/runner.rb +++ b/lib/bento/runner.rb @@ -90,7 +90,7 @@ def packer_build_cmd(template, _var_file) end if var_files cmd.insert(4, "-only=#{only}") if only cmd.insert(4, "-except=#{except}") if except - # Build the command line in the correct order and without spaces as future input for the splat operator. + cmd.insert(4, "-var 'sources_enabled=#{only.split(',').inspect}'") if only cmd.insert(4, "-var cpus=#{cpus}") if cpus cmd.insert(4, "-var memory=#{mem}") if mem cmd.insert(4, '-var headless=false') if headed diff --git a/lib/bento/upload.rb b/lib/bento/upload.rb index 078902800..7a79d6dcb 100644 --- a/lib/bento/upload.rb +++ b/lib/bento/upload.rb @@ -76,6 +76,15 @@ def upload_box(md_file) def lookup_slug(name) builds_yml['slugs'].each do |slug| return slug if name.start_with?(slug) + if slug.end_with?('latest') + box_name = slug.split('-').first + box_version = [] + Dir.glob("os_pkrvars/#{box_name}/**/*.pkrvars.hcl").each do |boxes| + box_version << File.basename(boxes).split('-')[1].to_i + end + latest = box_version.uniq!.max { |a, b| a <=> b } + return slug if name.start_with?("#{box_name}-#{latest}") + end end nil diff --git a/lib/bento/version.rb b/lib/bento/version.rb index 30e078423..cb7e9b360 100644 --- a/lib/bento/version.rb +++ b/lib/bento/version.rb @@ -1,3 +1,3 @@ module Bento - VERSION = '4.1.1'.freeze + VERSION = '4.1.2'.freeze end diff --git a/os_pkrvars/almalinux/almalinux-9-aarch64.pkrvars.hcl b/os_pkrvars/almalinux/almalinux-9-aarch64.pkrvars.hcl index 9a0c45b7b..a36a2f5b2 100644 --- a/os_pkrvars/almalinux/almalinux-9-aarch64.pkrvars.hcl +++ b/os_pkrvars/almalinux/almalinux-9-aarch64.pkrvars.hcl @@ -1,7 +1,7 @@ os_name = "almalinux" -os_version = "9.3" +os_version = "9.4" os_arch = "aarch64" -iso_url = "https://repo.almalinux.org/almalinux/9/isos/aarch64/AlmaLinux-9.3-aarch64-dvd.iso" +iso_url = "https://repo.almalinux.org/almalinux/9/isos/aarch64/AlmaLinux-9.4-aarch64-dvd.iso" iso_checksum = "file:https://repo.almalinux.org/almalinux/9/isos/aarch64/CHECKSUM" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" diff --git a/os_pkrvars/almalinux/almalinux-9-x86_64.pkrvars.hcl b/os_pkrvars/almalinux/almalinux-9-x86_64.pkrvars.hcl index 7a6a8456b..ac64fbf20 100644 --- a/os_pkrvars/almalinux/almalinux-9-x86_64.pkrvars.hcl +++ b/os_pkrvars/almalinux/almalinux-9-x86_64.pkrvars.hcl @@ -1,7 +1,7 @@ os_name = "almalinux" -os_version = "9.3" +os_version = "9.4" os_arch = "x86_64" -iso_url = "https://repo.almalinux.org/almalinux/9/isos/x86_64/AlmaLinux-9.3-x86_64-dvd.iso" +iso_url = "https://repo.almalinux.org/almalinux/9/isos/x86_64/AlmaLinux-9.4-x86_64-dvd.iso" iso_checksum = "file:https://repo.almalinux.org/almalinux/9/isos/x86_64/CHECKSUM" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" diff --git a/os_pkrvars/centos/centos-7-aarch64.pkrvars.hcl b/os_pkrvars/centos/centos-7-aarch64.pkrvars.hcl deleted file mode 100644 index 1d5b199f2..000000000 --- a/os_pkrvars/centos/centos-7-aarch64.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "centos" -os_version = "7.9" -os_arch = "aarch64" -iso_url = "https://quantum-mirror.hu/mirrors/pub/centos-altarch/7.9.2009/isos/aarch64/CentOS-7-aarch64-Minimal-2009.iso" -iso_checksum = "file:https://quantum-mirror.hu/mirrors/pub/centos-altarch/7.9.2009/isos/aarch64/sha256sum.txt" -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-other-64" -boot_command = ["e text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg x"] diff --git a/os_pkrvars/centos/centos-7-x86_64.pkrvars.hcl b/os_pkrvars/centos/centos-7-x86_64.pkrvars.hcl deleted file mode 100644 index b78910cf8..000000000 --- a/os_pkrvars/centos/centos-7-x86_64.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "centos" -os_version = "7.9" -os_arch = "x86_64" -iso_url = "http://mirrors.kernel.org/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2009.iso" -iso_checksum = "file:https://mirrors.edge.kernel.org/centos/7.9.2009/isos/x86_64/sha256sum.txt" -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "centos-64" -boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg"] diff --git a/os_pkrvars/centos/centos-stream-8-aarch64.pkrvars.hcl b/os_pkrvars/centos/centos-stream-8-aarch64.pkrvars.hcl deleted file mode 100644 index 08d946e6b..000000000 --- a/os_pkrvars/centos/centos-stream-8-aarch64.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "centos-stream" -os_version = "8" -os_arch = "aarch64" -iso_url = "https://mirrors.edge.kernel.org/centos/8-stream/isos/aarch64/CentOS-Stream-8-aarch64-latest-boot.iso" -iso_checksum = "file:https://mirrors.edge.kernel.org/centos/8-stream/isos/aarch64/CHECKSUM" -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-other-64" -boot_command = ["e inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/8ks.cfg x"] diff --git a/os_pkrvars/centos/centos-stream-8-x86_64.pkrvars.hcl b/os_pkrvars/centos/centos-stream-8-x86_64.pkrvars.hcl deleted file mode 100644 index c2bfab5e4..000000000 --- a/os_pkrvars/centos/centos-stream-8-x86_64.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "centos-stream" -os_version = "8" -os_arch = "x86_64" -iso_url = "http://mirrors.kernel.org/centos/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-dvd1.iso" -iso_checksum = "file:https://mirrors.edge.kernel.org/centos/8-stream/isos/x86_64/CHECKSUM" -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "centos-64" -boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/8ks.cfg"] diff --git a/os_pkrvars/oraclelinux/oraclelinux-7-aarch64.pkrvars.hcl b/os_pkrvars/oraclelinux/oraclelinux-7-aarch64.pkrvars.hcl deleted file mode 100644 index 8fbfc33f8..000000000 --- a/os_pkrvars/oraclelinux/oraclelinux-7-aarch64.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "oraclelinux" -os_version = "7.9" -os_arch = "aarch64" -iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL7/u9/aarch64/OracleLinux-R7-U9-Server-aarch64-dvd.iso" -iso_checksum = "fd2c1b1e26858576534f6e6c4cf000a15cd81bec010dad5e827b204a14a1750e" -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-other-64" -boot_command = ["e text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg x"] diff --git a/os_pkrvars/oraclelinux/oraclelinux-7-x86_64.pkrvars.hcl b/os_pkrvars/oraclelinux/oraclelinux-7-x86_64.pkrvars.hcl deleted file mode 100644 index 6bd8977ad..000000000 --- a/os_pkrvars/oraclelinux/oraclelinux-7-x86_64.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "oraclelinux" -os_version = "7.9" -os_arch = "x86_64" -iso_url = "http://mirrors.dotsrc.org/oracle-linux/OL7/u9/x86_64/OracleLinux-R7-U9-Server-x86_64-dvd.iso" -iso_checksum = "dc2782bfd92b4c060cf8006fbc6e18036c27f599eebf3584a1a2ac54f008bf2f" -parallels_guest_os_type = "centos" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "centos-64" -boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg"] diff --git a/os_pkrvars/oraclelinux/oraclelinux-9-aarch64.pkrvars.hcl b/os_pkrvars/oraclelinux/oraclelinux-9-aarch64.pkrvars.hcl index 7d64a0a65..0325a8108 100644 --- a/os_pkrvars/oraclelinux/oraclelinux-9-aarch64.pkrvars.hcl +++ b/os_pkrvars/oraclelinux/oraclelinux-9-aarch64.pkrvars.hcl @@ -1,8 +1,8 @@ os_name = "oraclelinux" -os_version = "9.3" +os_version = "9.4" os_arch = "aarch64" -iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL9/u3/aarch64/OracleLinux-R9-U3-aarch64-dvd.iso" -iso_checksum = "7cc50a48f361cb1100a28621ba455edaac3a38182f6dd3fe67588b3eeaf18dc3" +iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL9/u4/aarch64/OracleLinux-R9-U4-aarch64-dvd.iso" +iso_checksum = "file:https://linux.oracle.com/security/gpg/checksum/OracleLinux-R9-U4-Server-aarch64.checksum" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" vmware_guest_os_type = "arm-rhel9-64" diff --git a/os_pkrvars/oraclelinux/oraclelinux-9-x86_64.pkrvars.hcl b/os_pkrvars/oraclelinux/oraclelinux-9-x86_64.pkrvars.hcl index 0aa28f6e1..221a8564d 100644 --- a/os_pkrvars/oraclelinux/oraclelinux-9-x86_64.pkrvars.hcl +++ b/os_pkrvars/oraclelinux/oraclelinux-9-x86_64.pkrvars.hcl @@ -1,8 +1,8 @@ os_name = "oraclelinux" -os_version = "9.3" +os_version = "9.4" os_arch = "x86_64" -iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL9/u3/x86_64/OracleLinux-R9-U3-x86_64-dvd.iso" -iso_checksum = "242f0ecc37417995137507862cb170215c0b5bd512c47badd16b623686ef39e2" +iso_url = "https://yum.oracle.com/ISOS/OracleLinux/OL9/u4/x86_64/OracleLinux-R9-U4-x86_64-dvd.iso" +iso_checksum = "file:https://linux.oracle.com/security/gpg/checksum/OracleLinux-R9-U4-Server-x86_64.checksum" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" vmware_guest_os_type = "centos-64" diff --git a/os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl b/os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl deleted file mode 100644 index 940473f9a..000000000 --- a/os_pkrvars/rhel/rhel-7-aarch64.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "rhel" -os_version = "7.9" -os_arch = "aarch64" -iso_url = "https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux" -iso_checksum = "1b8004961150b60f6c5ec3f25139d3217eee55707cf9fa19e826919fc58e328b" -parallels_guest_os_type = "rhel" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "arm-other-64" -boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg"] diff --git a/os_pkrvars/rhel/rhel-7-x86_64.pkrvars.hcl b/os_pkrvars/rhel/rhel-7-x86_64.pkrvars.hcl deleted file mode 100644 index d3f3d5372..000000000 --- a/os_pkrvars/rhel/rhel-7-x86_64.pkrvars.hcl +++ /dev/null @@ -1,9 +0,0 @@ -os_name = "rhel" -os_version = "7.9" -os_arch = "x86_64" -iso_url = "https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux" -iso_checksum = "1b8004961150b60f6c5ec3f25139d3217eee55707cf9fa19e826919fc58e328b" -parallels_guest_os_type = "rhel" -vbox_guest_os_type = "RedHat_64" -vmware_guest_os_type = "centos-64" -boot_command = [" inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/rhel/7ks.cfg"] diff --git a/os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl b/os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl index 42d86f15d..cde337d59 100644 --- a/os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl +++ b/os_pkrvars/rhel/rhel-9-aarch64.pkrvars.hcl @@ -1,5 +1,5 @@ os_name = "rhel" -os_version = "9.3" +os_version = "9.4" os_arch = "aarch64" iso_url = "https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux" iso_checksum = "none" diff --git a/os_pkrvars/rhel/rhel-9-x86_64.pkrvars.hcl b/os_pkrvars/rhel/rhel-9-x86_64.pkrvars.hcl index aac6e2b5d..25909fb92 100644 --- a/os_pkrvars/rhel/rhel-9-x86_64.pkrvars.hcl +++ b/os_pkrvars/rhel/rhel-9-x86_64.pkrvars.hcl @@ -1,5 +1,5 @@ os_name = "rhel" -os_version = "9.3" +os_version = "9.4" os_arch = "x86_64" iso_url = "https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux" iso_checksum = "none" diff --git a/os_pkrvars/rockylinux/rockylinux-9-aarch64.pkrvars.hcl b/os_pkrvars/rockylinux/rockylinux-9-aarch64.pkrvars.hcl index f3d975df4..838bc2d50 100644 --- a/os_pkrvars/rockylinux/rockylinux-9-aarch64.pkrvars.hcl +++ b/os_pkrvars/rockylinux/rockylinux-9-aarch64.pkrvars.hcl @@ -1,7 +1,7 @@ os_name = "rockylinux" -os_version = "9.3" +os_version = "9.4" os_arch = "aarch64" -iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/aarch64/Rocky-9.3-aarch64-minimal.iso" +iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/aarch64/Rocky-9.4-aarch64-minimal.iso" iso_checksum = "file:https://download.rockylinux.org/pub/rocky/9/isos/aarch64/CHECKSUM" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" diff --git a/os_pkrvars/rockylinux/rockylinux-9-x86_64.pkrvars.hcl b/os_pkrvars/rockylinux/rockylinux-9-x86_64.pkrvars.hcl index 19438d23a..73aa82e53 100644 --- a/os_pkrvars/rockylinux/rockylinux-9-x86_64.pkrvars.hcl +++ b/os_pkrvars/rockylinux/rockylinux-9-x86_64.pkrvars.hcl @@ -1,7 +1,7 @@ os_name = "rockylinux" -os_version = "9.3" +os_version = "9.4" os_arch = "x86_64" -iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.3-x86_64-dvd.iso" +iso_url = "https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.4-x86_64-dvd.iso" iso_checksum = "file:https://download.rockylinux.org/pub/rocky/9/isos/x86_64/CHECKSUM" parallels_guest_os_type = "centos" vbox_guest_os_type = "RedHat_64" diff --git a/packer_templates/http/ubuntu/user-data b/packer_templates/http/ubuntu/user-data index 5e619f9a5..f1b517f1b 100644 --- a/packer_templates/http/ubuntu/user-data +++ b/packer_templates/http/ubuntu/user-data @@ -19,4 +19,11 @@ autoinstall: fi - echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/vagrant # Enable hyper-v daemons only if using hyper-v virtualization - - if [ $(virt-what) == "hyperv" ]; then apt-get update && apt-get install -y hyperv-daemons linux-tools-$(uname -r) linux-cloud-tools-$(uname -r) linux-cloud-tools-common cifs-utils && systemctl enable hypervvssd && systemctl enable hypervkvpd && systemctl start hypervvssd && systemctl start hypervkvpd; fi + - | + if [ $(virt-what) == "hyperv" ]; then + apt-get update && apt-get install -y hyperv-daemons linux-tools-$(uname -r) linux-cloud-tools-$(uname -r) linux-cloud-tools-common cifs-utils + systemctl enable hypervvssd + systemctl enable hypervkvpd + systemctl start hypervvssd + systemctl start hypervkvpd + fi diff --git a/packer_templates/pkr-builder.pkr.hcl b/packer_templates/pkr-builder.pkr.hcl index 6c62ae330..519fb889d 100644 --- a/packer_templates/pkr-builder.pkr.hcl +++ b/packer_templates/pkr-builder.pkr.hcl @@ -123,10 +123,7 @@ locals { "${path.root}/scripts/fedora/cleanup_dnf.sh", "${path.root}/scripts/_common/minimize.sh" ] : ( - "${var.os_name}-${var.os_version}" == "amazonlinux-2" || - "${var.os_name}-${substr(var.os_version, 0, 1)}" == "centos-7" || - "${var.os_name}-${substr(var.os_version, 0, 1)}" == "oraclelinux-7" || - "${var.os_name}-${substr(var.os_version, 0, 1)}" == "rhel-7" ? [ + "${var.os_name}-${var.os_version}" == "amazonlinux-2" ? [ "${path.root}/scripts/rhel/update_yum.sh", "${path.root}/scripts/_common/motd.sh", "${path.root}/scripts/_common/sshd.sh", diff --git a/packer_templates/pkr-sources.pkr.hcl b/packer_templates/pkr-sources.pkr.hcl index 58e48758a..4c31488e3 100644 --- a/packer_templates/pkr-sources.pkr.hcl +++ b/packer_templates/pkr-sources.pkr.hcl @@ -35,7 +35,11 @@ locals { ) : var.parallels_prlctl # qemu - qemu_binary = var.qemu_binary == null ? "qemu-system-${var.os_arch}" : var.qemu_binary + qemu_binary = var.qemu_binary == null ? "qemu-system-${var.os_arch}" : var.qemu_binary + qemu_display = var.qemu_display == null ? "none" : var.qemu_display + qemu_use_default_display = var.qemu_use_default_display == null ? ( + var.os_arch == "aarch64" ? true : false + ) : var.qemu_use_default_display qemu_machine_type = var.qemu_machine_type == null ? ( var.os_arch == "aarch64" ? "virt" : "q35" ) : var.qemu_machine_type @@ -47,6 +51,8 @@ locals { ] : ( var.os_arch == "aarch64" ? [ ["-boot", "strict=off"] + # ["-cpu", "host"], + # ["-monitor", "stdio"] ] : null ) ) : var.qemuargs @@ -209,17 +215,18 @@ source "parallels-iso" "vm" { } source "qemu" "vm" { # QEMU specific options - accelerator = var.qemu_accelerator - display = var.headless ? "none" : var.qemu_display - disk_image = var.qemu_disk_image - efi_boot = var.qemu_efi_boot - efi_firmware_code = var.qemu_efi_firmware_code - efi_firmware_vars = var.qemu_efi_firmware_vars - efi_drop_efivars = var.qemu_efi_drop_efivars - format = var.qemu_format - machine_type = local.qemu_machine_type - qemu_binary = local.qemu_binary - qemuargs = local.qemuargs + accelerator = var.qemu_accelerator + display = local.qemu_display + use_default_display = local.qemu_use_default_display + disk_image = var.qemu_disk_image + efi_boot = var.qemu_efi_boot + efi_firmware_code = var.qemu_efi_firmware_code + efi_firmware_vars = var.qemu_efi_firmware_vars + efi_drop_efivars = var.qemu_efi_drop_efivars + format = var.qemu_format + machine_type = local.qemu_machine_type + qemu_binary = local.qemu_binary + qemuargs = local.qemuargs # Source block common options boot_command = var.boot_command boot_wait = var.qemu_boot_wait == null ? local.default_boot_wait : var.qemu_boot_wait diff --git a/packer_templates/pkr-variables.pkr.hcl b/packer_templates/pkr-variables.pkr.hcl index 5b0c027fd..5a6354105 100644 --- a/packer_templates/pkr-variables.pkr.hcl +++ b/packer_templates/pkr-variables.pkr.hcl @@ -142,8 +142,14 @@ variable "qemu_boot_wait" { default = null } variable "qemu_display" { - type = string - default = "none" + type = string + default = null + description = "What QEMU -display option to use. Defaults to gtk, use none to not pass the -display option allowing QEMU to choose the default" +} +variable "qemu_use_default_display" { + type = bool + default = null + description = "If true, do not pass a -display option to qemu, allowing it to choose the default" } variable "qemu_disk_image" { type = bool @@ -171,8 +177,12 @@ variable "qemu_efi_drop_efivars" { description = "Drop EFI vars" } variable "qemu_format" { - type = string - default = "qcow2" + type = string + default = "qcow2" + validation { + condition = var.qemu_format == "qcow2" || var.qemu_format == "raw" + error_message = "Disk format, takes qcow2 or raw." + } description = "Disk format, takes qcow2 or raw" } variable "qemu_machine_type" {