Skip to content

Commit

Permalink
switch to ubuntu-latest runners
Browse files Browse the repository at this point in the history
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
  • Loading branch information
Stromweld committed Apr 2, 2024
1 parent 292fdc6 commit c429861
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 82 deletions.
65 changes: 36 additions & 29 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,45 +28,52 @@ jobs:
powershell-lint:
uses: chef/github-workflows/.github/workflows/powershell-lint.yml@main

# pkr-bld-amazonlinux-x64:
# uses: ./.github/workflows/pkr-bld-amazonlinux-x64.yml
# secrets: inherit

pkr-bld-hyperv-x64:
uses: ./.github/workflows/pkr-bld-hyperv-x64.yml
secrets: inherit

pkr-bld-parallels-arm64:
uses: ./.github/workflows/pkr-bld-parallels-arm64.yml
secrets: inherit
packer-iso-check:
uses: chef/github-workflows/.github/workflows/packer-iso-url-checker.yml@main

pkr-bld-parallels-x64:
uses: ./.github/workflows/pkr-bld-parallels-x64.yml
packer-lint:
uses: chef/github-workflows/.github/workflows/packer-lint.yml@main
secrets: inherit

pkr-bld-qemu-arm64:
uses: ./.github/workflows/pkr-bld-qemu-arm64.yml
pkr-bld-amazonlinux-x64:
uses: ./.github/workflows/pkr-bld-amazonlinux-x64.yml
secrets: inherit

pkr-bld-qemu-x64:
uses: ./.github/workflows/pkr-bld-qemu-x64.yml
secrets: inherit

pkr-bld-virtualbox-arm64:
uses: ./.github/workflows/pkr-bld-virtualbox-arm64.yml
secrets: inherit
# pkr-bld-hyperv-x64:
# uses: ./.github/workflows/pkr-bld-hyperv-x64.yml
# secrets: inherit
#
# pkr-bld-parallels-arm64:
# uses: ./.github/workflows/pkr-bld-parallels-arm64.yml
# secrets: inherit
#
# pkr-bld-parallels-x64:
# uses: ./.github/workflows/pkr-bld-parallels-x64.yml
# secrets: inherit
#
# pkr-bld-qemu-arm64:
# uses: ./.github/workflows/pkr-bld-qemu-arm64.yml
# secrets: inherit
#
# pkr-bld-qemu-x64:
# uses: ./.github/workflows/pkr-bld-qemu-x64.yml
# secrets: inherit
#
# pkr-bld-virtualbox-arm64:
# uses: ./.github/workflows/pkr-bld-virtualbox-arm64.yml
# secrets: inherit

pkr-bld-virtualbox-x64:
uses: ./.github/workflows/pkr-bld-virtualbox-x64.yml
secrets: inherit

pkr-bld-vmware-arm64:
uses: ./.github/workflows/pkr-bld-vmware-arm64.yml
secrets: inherit

pkr-bld-vmware-x64:
uses: ./.github/workflows/pkr-bld-vmware-x64.yml
secrets: inherit
# pkr-bld-vmware-arm64:
# uses: ./.github/workflows/pkr-bld-vmware-arm64.yml
# secrets: inherit
#
# pkr-bld-vmware-x64:
# uses: ./.github/workflows/pkr-bld-vmware-x64.yml
# secrets: inherit

check_jobs_pass:
if: always()
Expand Down
56 changes: 31 additions & 25 deletions .github/workflows/pkr-bld-amazonlinux-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,49 @@ env:

jobs:
x86_64:
runs-on: [self-hosted, X64, virtualbox]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- amazonlinux-2
- amazonlinux-2023
steps:
- name: Install Vagrant and 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 [arch=amd64 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 vagrant virtualbox
- name: Install Chef
uses: actionshub/chef-install@3.0.0
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
version: latest
- name: Checkout
uses: actions/checkout@main
# - name: Setup Packer
# uses: hashicorp/setup-packer@main
# with:
# version: latest
- name: Packer Init
run: packer init -upgrade packer_templates
- name: Packer FMT
run: if packer fmt -check -recursive .; then exit 0; else echo "Some packer files need to be formatted, run 'packer fmt -recursive .' to fix"; exit 1; fi
- name: Packer Validate
run: packer validate -var-file=os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" packer_templates
- name: Bento build
- name: Install Bento
run: |
eval "$(chef shell-init bash)"
./AMZ_build_virtualbox-ovf.sh
bento build --metadata_only os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl"
gem build bento.gemspec
gem install bento-*.gem
- name: Bento build
run: |
./${{ matrix.os }}-x86_64-virtualbox.sh
ls -alh builds
# - name: Bento Test
- name: Bento Test
run: bento test
# - name: Remove VM in case of canceled job
# if: cancelled()
# run: |
# eval "$(chef shell-init bash)"
# bento test
- name: Remove VM in case of canceled job
if: cancelled()
run: |
echo Powering off and deleting any existing VMs named AmazonLinuxBento
VBoxManage controlvm AmazonLinuxBento poweroff --type headless 2> /dev/null
sleep 1
VBoxManage unregistervm AmazonLinuxBento --delete 2> /dev/null
sleep 2
# echo Powering off and deleting any existing VMs named AmazonLinuxBento
# VBoxManage controlvm AmazonLinuxBento poweroff --type headless 2> /dev/null
# sleep 1
# VBoxManage unregistervm AmazonLinuxBento --delete 2> /dev/null
# sleep 2
- name: Upload build artifact
uses: actions/upload-artifact@main
with:
Expand Down
57 changes: 30 additions & 27 deletions .github/workflows/pkr-bld-virtualbox-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:

jobs:
x86_64:
runs-on: [self-hosted, X64, virtualbox]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -35,39 +35,42 @@ jobs:
provider:
- virtualbox-iso
steps:
- name: Install Vagrant and 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 [arch=amd64 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 vagrant virtualbox
- name: Install Chef
uses: actionshub/chef-install@3.0.0
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
version: latest
- name: Checkout
uses: actions/checkout@main
- name: iso-availability
shell: pwsh
run: Invoke-RestMethod -Method Head -Verbose -Uri $(Get-Content os_pkrvars/$('${{ matrix.os }}'.split('-')[0])/${{ matrix.os }}-x86_64.pkrvars.hcl | ConvertFrom-StringData).iso_url.Trim('"')
# - name: Setup Packer
# uses: hashicorp/setup-packer@main
# with:
# version: latest
- name: Packer Init
run: packer init -upgrade packer_templates
- name: Packer FMT
run: if packer fmt -check -recursive .; then exit 0; else echo "Some packer files need to be formatted, run 'packer fmt -recursive .' to fix"; exit 1; fi
- name: Packer Validate
run: packer validate -var-file=os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" packer_templates
- name: Packer build
# run: packer build -timestamp-ui -only=${{ matrix.provider }}.vm -var-file=os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" packer_templates
- 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
# - name: Bento Test
- name: Bento Test
run: bento test
# - name: Remove VM in case of canceled job
# if: cancelled()
# run: |
# eval "$(chef shell-init bash)"
# bento test
- name: Remove VM in case of canceled job
if: cancelled()
run: |
echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-amd64
VBoxManage controlvm ${{ matrix.os }}*-amd64 poweroff --type headless 2> /dev/null
sleep 1
VBoxManage unregistervm ${{ matrix.os }}*-amd64 --delete 2> /dev/null
sleep 2
# echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-amd64
# VBoxManage controlvm ${{ matrix.os }}*-amd64 poweroff --type headless 2> /dev/null
# sleep 1
# VBoxManage unregistervm ${{ matrix.os }}*-amd64 --delete 2> /dev/null
# sleep 2
- name: Upload build artifact
uses: actions/upload-artifact@main
with:
Expand Down
2 changes: 1 addition & 1 deletion amazonlinux-2023-x86_64-virtualbox-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ echo "Deleting the VM"
vboxmanage unregistervm $VM --delete

echo "starting packer build of amazonlinux"
if packer build -timestamp-ui -var "vbox_source_path=$AMZDIR/amazon2023_x86_64.ovf" -var "vbox_checksum=null" -var-file="$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl "$AMZDIR"/../../packer_templates; then
if bento build -var "vbox_source_path=$AMZDIR/amazon2023_x86_64.ovf" -var "vbox_checksum=null" "$AMZDIR"/../../os_pkrvars/amazonlinux/amazonlinux-2023-x86_64.pkrvars.hcl; then
echo "Cleaning up files"
rm -f "$AMZDIR"/*.ovf "$AMZDIR"/*.vmdk "$AMZDIR"/*.iso "$AMZDIR"/*.vdi "$AMZDIR"/*.qcow2
else
Expand Down

0 comments on commit c429861

Please sign in to comment.