Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 18 additions & 77 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,98 +10,43 @@ concurrency:
cancel-in-progress: true

jobs:
# markdown-lint:
# uses: chef/github-workflows/.github/workflows/markdown-lint.yml@main
#
# markdown-link-checker:
# uses: chef/github-workflows/.github/workflows/markdown-link-checker.yml@main

yaml-lint:
uses: chef/github-workflows/.github/workflows/yaml-lint.yml@main

json-lint:
uses: chef/github-workflows/.github/workflows/json-lint.yml@main

xml-lint:
uses: chef/github-workflows/.github/workflows/xml-lint.yml@main

shellcheck-lint:
uses: chef/github-workflows/.github/workflows/shellcheck-lint.yml@main

powershell-lint:
uses: chef/github-workflows/.github/workflows/powershell-lint.yml@main

packer-iso-check:
uses: chef/github-workflows/.github/workflows/packer-iso-url-checker.yml@main
with:
EXCLUDE_REGEX: 'amazonlinux-2.*|rhel.*|sles.*|solaris.*|macos-.*'

# packer-lint:
# uses: chef/github-workflows/.github/workflows/packer-lint.yml@main
# secrets: inherit

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

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

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

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

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

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

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

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

pkr-bld-utm-x64:
uses: ./.github/workflows/pkr-bld-utm-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
pkr-bld-vmware:
uses: ./.github/workflows/pkr-bld-vmware.yml
secrets: inherit

check_jobs_pass:
if: always()
needs:
# - markdown-lint
- yaml-lint
- json-lint
- xml-lint
- powershell-lint
- shellcheck-lint
# - packer-lint
- ci-lint

runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand All @@ -110,7 +55,3 @@ jobs:
allowed-failures:
allowed-skips: ${{ toJSON(needs) }}
jobs: ${{ toJSON(needs) }}

# pkr-bld-parallels-test:
# uses: ./.github/workflows/test-pkr-bld-parallels.yml
# secrets: inherit
22 changes: 13 additions & 9 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
---
on:
workflow_call:
schedule:
- cron: '0 0 * * 0'

permissions:
contents: read

concurrency:
group: ci-lint-${{ github.ref }}
cancel-in-progress: true

jobs:
markdown-lint:
uses: chef/github-workflows/.github/workflows/markdown-lint.yml@main
Expand All @@ -28,19 +33,18 @@ jobs:
powershell-lint:
uses: chef/github-workflows/.github/workflows/powershell-lint.yml@main

packer-iso-check:
uses: chef/github-workflows/.github/workflows/packer-iso-url-checker.yml@main

packer-lint:
uses: chef/github-workflows/.github/workflows/packer-lint.yml@main
secrets: inherit

# Codespell configuration is within .codespellrc
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@main
- name: Codespell
uses: codespell-project/actions-codespell@v2

packer-lint:
uses: ./.github/workflows/packer-lint.yml
secrets: inherit

packer-iso-check:
uses: ./.github/workflows/packer-iso-url-checker.yml
40 changes: 40 additions & 0 deletions .github/workflows/packer-iso-url-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
on:
workflow_call:

jobs:
enumerate_pkrvars:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Enumerate iso
env:
EXCLUDE: 'rhel.*|sles.*|solaris.*'
shell: bash
run: |
mapfile -t < <(find os_pkrvars -name "*.pkrvars.hcl" | grep -Ev '(${{ env.EXCLUDE }})')
echo "matrix=$(jq -cRn '[inputs]' < <( (( ${#MAPFILE[@]} )) && printf '%s\n' "${MAPFILE[@]}"))" >> "$GITHUB_OUTPUT"
id: enumerate_pkrvars
outputs:
matrix: ${{ steps.enumerate_pkrvars.outputs.matrix }}

iso-availability:
needs: enumerate_pkrvars
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
template: ${{ fromJson(needs.enumerate_pkrvars.outputs.matrix) }}
steps:
- name: Checkout Repository
uses: actions/checkout@main
- name: iso-availability
run: |
iso_url=$(grep -E '^\s*iso_url\s*=' '${{ matrix.template }}' | head -1 | sed 's/[^=]*=\s*"\(.*\)"/\1/')
if [ -z "$iso_url" ]; then
echo "No iso_url found in ${{ matrix.template }}, skipping"
exit 0
fi
echo "Checking: $iso_url"
curl -fsSI "$iso_url"
53 changes: 53 additions & 0 deletions .github/workflows/packer-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
on:
workflow_call:

jobs:
packer-fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
version: latest
- 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

enumerate_pkrvars:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Enumerate pkrvars validation
env:
EXCLUDE: 'windows.*'
shell: bash
run: |
mapfile -t < <(find os_pkrvars -name "*.pkrvars.hcl" | grep -Ev '(${{ env.EXCLUDE }})')
echo "matrix=$(jq -cRn '[inputs]' < <( (( ${#MAPFILE[@]} )) && printf '%s\n' "${MAPFILE[@]}"))" >> "$GITHUB_OUTPUT"
id: enumerate_pkrvars
outputs:
matrix: ${{ steps.enumerate_pkrvars.outputs.matrix }}

packer-validate:
needs: enumerate_pkrvars
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pkrvars: ${{ fromJson(needs.enumerate_pkrvars.outputs.matrix) }}
steps:
- name: Checkout Repository
uses: actions/checkout@main
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
version: latest
- name: Packer Init
env:
PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: packer init -upgrade packer_templates
- name: Packer Validate
run: packer validate --evaluate-datasources -var-file="${{ matrix.pkrvars }}" packer_templates
115 changes: 115 additions & 0 deletions .github/workflows/pkr-bld-amazonlinux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
on:
workflow_call:

permissions:
contents: read

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

jobs:
x86_64:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- 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 [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.1 qemu-utils genisoimage
VBoxManage --version
vagrant --version
- 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: Install Bento
run: |
eval "$(chef shell-init bash)"
gem build bento.gemspec
gem install bento-*.gem
- name: Bento build
run: |
rm -rf builds
sudo mkdir -p /mnt/builds/iso
sudo mkdir -p /mnt/builds/build_complete
sudo chmod -R 777 /mnt/builds
sudo ln -s /mnt/builds ./
eval "$(chef shell-init bash)"
./${{ matrix.os }}-x86_64-virtualbox-build.sh
ls -alh builds/build_complete
cat builds/build_complete/${{ matrix.os }}*-x86_64._metadata.json
- name: Remove VM in case of canceled job
if: cancelled()
run: |
VM="$(VBoxManage list vms | grep '${{ matrix.os }}' | awk -F'"' '{print $2}')"
echo "VM Name: $VM"
VBoxManage controlvm "$VM" poweroff 2>/dev/null || true
sleep 2
VBoxManage unregistervm "$VM" --delete 2>/dev/null || true
- name: Bento Test
run: |
eval "$(chef shell-init bash)"
bento test
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.os }}-virtualbox-x86_64"
path: |
builds/testing_passed/x86_64/*.box
builds/testing_passed/x86_64/*.json
overwrite: true
retention-days: 10
compression-level: 0 # no compression

aarch64:
runs-on: [self-hosted, ARM64, virtualbox]
strategy:
fail-fast: false
matrix:
os:
- amazonlinux-2023
steps:
- name: Checkout
uses: actions/checkout@main
- name: Bento build
run: |
eval "$(chef shell-init bash)"
./${{ matrix.os }}-aarch64-virtualbox-build.sh
ls -alh builds/build_complete
cat builds/build_complete/${{ matrix.os }}*-aarch64._metadata.json
- name: Remove VM in case of canceled job
if: cancelled()
run: |
VM="$(VBoxManage list vms | grep '${{ matrix.os }}' | awk -F'"' '{print $2}')"
echo "VM Name: $VM"
VBoxManage controlvm "$VM" poweroff 2>/dev/null || true
sleep 2
VBoxManage unregistervm "$VM" --delete 2>/dev/null || true
- name: Bento Test
run: |
eval "$(chef shell-init bash)"
bento test
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.os }}-virtualbox-aarch64"
path: |
builds/testing_passed/aarch64/*.box
builds/testing_passed/aarch64/*.json
overwrite: true
retention-days: 10
compression-level: 0 # no compression
Loading
Loading