Skip to content

Commit

Permalink
setup workflow for hosted runners (#1547)
Browse files Browse the repository at this point in the history
* setup workflow for hosted runners
  • Loading branch information
Stromweld authored May 23, 2024
1 parent 036e8d1 commit 2b80f1c
Show file tree
Hide file tree
Showing 42 changed files with 567 additions and 228 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion .github/workflows/pkr-bld-amazonlinux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

env:
PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PACKER_LOG: "1"
# PACKER_LOG: "1"

jobs:
x86_64:
Expand All @@ -28,6 +28,8 @@ jobs:
vagrant --version
- name: Install Chef
uses: actionshub/[email protected]
with:
version: 24.2.1058
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
Expand All @@ -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
Expand All @@ -61,4 +64,5 @@ jobs:
- name: Bento Test
run: |
eval "$(chef shell-init bash)"
export LOGNAME=$USER
bento test
48 changes: 29 additions & 19 deletions .github/workflows/pkr-bld-hyperv-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/[email protected]
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:
Expand All @@ -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
5 changes: 1 addition & 4 deletions .github/workflows/pkr-bld-parallels-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

env:
PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PACKER_LOG: "1"
# PACKER_LOG: "1"

jobs:
aarch64:
Expand All @@ -15,8 +15,6 @@ jobs:
os:
- almalinux-8
- almalinux-9
- centos-7
- centos-stream-8
- centos-stream-9
- debian-11
- debian-12
Expand All @@ -25,7 +23,6 @@ jobs:
- freebsd-13
- freebsd-14
- opensuse-leap-15
- oraclelinux-7
- oraclelinux-8
- oraclelinux-9
- rockylinux-8
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/pkr-bld-parallels-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

env:
PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PACKER_LOG: "1"
# PACKER_LOG: "1"

jobs:
x86_64:
Expand All @@ -15,8 +15,6 @@ jobs:
os:
- almalinux-8
- almalinux-9
- centos-7
- centos-stream-8
- centos-stream-9
- debian-11
- debian-12
Expand All @@ -25,7 +23,6 @@ jobs:
- freebsd-13
- freebsd-14
- opensuse-leap-15
- oraclelinux-7
- oraclelinux-8
- oraclelinux-9
- rockylinux-8
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/pkr-bld-qemu-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,7 +23,6 @@ jobs:
- freebsd-13
- freebsd-14
- opensuse-leap-15
- oraclelinux-7
- oraclelinux-8
- oraclelinux-9
- rockylinux-8
Expand All @@ -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/[email protected]
with:
version: 24.2.1058
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pkr-bld-qemu-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

env:
PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PACKER_LOG: "1"
# PACKER_LOG: "1"

jobs:
x86_64:
Expand All @@ -15,8 +15,6 @@ jobs:
os:
- almalinux-8
- almalinux-9
- centos-7
- centos-stream-8
- centos-stream-9
- debian-11
- debian-12
Expand All @@ -25,7 +23,6 @@ jobs:
- freebsd-13
- freebsd-14
- opensuse-leap-15
- oraclelinux-7
- oraclelinux-8
- oraclelinux-9
- rockylinux-8
Expand All @@ -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
Expand All @@ -58,6 +54,8 @@ jobs:
sudo systemctl status libvirtd
- name: Install Chef
uses: actionshub/[email protected]
with:
version: 24.2.1058
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/pkr-bld-virtualbox-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,7 +23,6 @@ jobs:
- freebsd-13
- freebsd-14
- opensuse-leap-15
- oraclelinux-7
- oraclelinux-8
- oraclelinux-9
- rockylinux-8
Expand All @@ -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/[email protected]
with:
version: 24.2.1058
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/pkr-bld-virtualbox-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -15,8 +15,6 @@ jobs:
os:
- almalinux-8
- almalinux-9
- centos-7
- centos-stream-8
- centos-stream-9
- debian-11
- debian-12
Expand All @@ -25,7 +23,6 @@ jobs:
- freebsd-13
- freebsd-14
- opensuse-leap-15
- oraclelinux-7
- oraclelinux-8
- oraclelinux-9
- rockylinux-8
Expand All @@ -38,18 +35,18 @@ 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
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
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/[email protected]
with:
version: 24.2.1058
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
Expand All @@ -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
Expand All @@ -81,4 +79,5 @@ jobs:
- name: Bento Test
run: |
eval "$(chef shell-init bash)"
export LOGNAME=$USER
bento test
Loading

0 comments on commit 2b80f1c

Please sign in to comment.