From c4298613ce23dbb461ca6b9d477bbbbf12a0ad31 Mon Sep 17 00:00:00 2001 From: Corey Hemminger Date: Tue, 2 Apr 2024 15:59:06 -0500 Subject: [PATCH] switch to ubuntu-latest runners Signed-off-by: Corey Hemminger --- .github/workflows/ci-build.yml | 65 ++++++++++--------- .github/workflows/pkr-bld-amazonlinux-x64.yml | 56 +++++++++------- .github/workflows/pkr-bld-virtualbox-x64.yml | 57 ++++++++-------- amazonlinux-2023-x86_64-virtualbox-build.sh | 2 +- 4 files changed, 98 insertions(+), 82 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 6864185e1..19ab74539 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -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() diff --git a/.github/workflows/pkr-bld-amazonlinux-x64.yml b/.github/workflows/pkr-bld-amazonlinux-x64.yml index 033202112..b1064991c 100644 --- a/.github/workflows/pkr-bld-amazonlinux-x64.yml +++ b/.github/workflows/pkr-bld-amazonlinux-x64.yml @@ -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: diff --git a/.github/workflows/pkr-bld-virtualbox-x64.yml b/.github/workflows/pkr-bld-virtualbox-x64.yml index e3d29389e..1efd6b24b 100644 --- a/.github/workflows/pkr-bld-virtualbox-x64.yml +++ b/.github/workflows/pkr-bld-virtualbox-x64.yml @@ -7,7 +7,7 @@ env: jobs: x86_64: - runs-on: [self-hosted, X64, virtualbox] + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -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: diff --git a/amazonlinux-2023-x86_64-virtualbox-build.sh b/amazonlinux-2023-x86_64-virtualbox-build.sh index f58fb84b6..0ba10c1a0 100755 --- a/amazonlinux-2023-x86_64-virtualbox-build.sh +++ b/amazonlinux-2023-x86_64-virtualbox-build.sh @@ -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