diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000..4f6fcab78 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,6 @@ +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = .git,.gitignore,.gitattributes,.codespellrc,.npm,.cache,.local +check-hidden = true +# ignore-regex = +# ignore-words-list = diff --git a/.expeditor/config.yml b/.expeditor/config.yml new file mode 100644 index 000000000..0dd1eee90 --- /dev/null +++ b/.expeditor/config.yml @@ -0,0 +1,10 @@ +# Documentation available at https://expeditor.chef.io/docs/getting-started/ +--- + +# Slack channel in Chef Software slack to send notifications about build failures, etc +slack: + notify_channel: chef-found-notify + +github: + # This deletes the GitHub PR branch after successfully merged into the release branch + delete_branch_on_merge: true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..d7448ebe2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,15 @@ +# Detect text files automatically +* text=auto + +# Force LF line ending on these files +*.sh eol=lf + +ks.cfg eol=lf +preseed.cfg eol=lf + +# Force CRLF line ending on these files +*.bat eol=crlf +Autounattend.xml eol=crlf + +# Force binary on these files +*.cer binary diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..5ac3b7918 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# Order is important. The last matching pattern has the most precedence. + +* @chef/chef-workstation-owners @chef/chef-workstation-approvers @chef/chef-workstation-reviewers @Stromweld +.expeditor/ @chef/jex-team +*.md @chef/docs-team diff --git a/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md b/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md new file mode 100644 index 000000000..99ec9e140 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md @@ -0,0 +1,29 @@ +--- +name: � Bug Report +about: If something isn't working as expected �. +labels: "Status: Untriaged" +--- + +# Version + +[Version of the project installed] + +## Environment + +[Details about the environment such as the Operating System, cookbook details, etc...] + +## Scenario + +[What you are trying to achieve and you can't?] + +## Steps to Reproduce + +[If you are filing an issue what are the things we need to do in order to repro your problem?] + +## Expected Result + +[What are you expecting to happen as the consequence of above reproduction steps?] + +## Actual Result + +[What actually happens after the reproduction steps?] diff --git a/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md b/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md new file mode 100644 index 000000000..46c5c98e7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md @@ -0,0 +1,40 @@ +--- +name: Design Proposal +about: I have a significant change I would like to propose and discuss before starting +labels: "Status: Untriaged" +--- + +# When a Change Needs a Design Proposal + +A design proposal should be opened any time a change meets one of the following qualifications: + +- Significantly changes the user experience of a project in a way that impacts users. +- Significantly changes the underlying architecture of the project in a way that impacts other developers. +- Changes the development or testing process of the project such as a change of CI systems or test frameworks. + +## Why We Use This Process + +- Allows all interested parties (including any community member) to discuss large impact changes to a project. +- Serves as a durable paper trail for discussions regarding project architecture. +- Forces design discussions to occur before PRs are created. +- Reduces PR refactoring and rejected PRs. + +--- + + + +## Motivation + + + +## Specification + + + +## Downstream Impact + + diff --git a/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md b/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..bea4375f2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md @@ -0,0 +1,21 @@ +--- +name: 🚀 Enhancement Request +about: I have a suggestion (and may want to implement it 🙂)! +labels: "Status: Untriaged" +--- + +# Describe the Enhancement + + + +## Describe the Need + + + +## Current Alternative + + + +## Can We Help You Implement This + + diff --git a/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md b/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md new file mode 100644 index 000000000..1f0b925a3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md @@ -0,0 +1,11 @@ +--- +name: 🤗 Support Question +about: If you have a question 💬, please check out our Slack! +--- + +We use GitHub issues to track bugs and feature requests. If you need help please post to our Mailing List or join the Chef Community Slack. + +- Chef Community Slack at . +- Chef Mailing List + + Support issues opened here will be closed and redirected to Slack or Discourse. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..0967c13fd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,9 @@ +version: 2 +updates: +- package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + time: "06:00" + timezone: America/Los_Angeles + open-pull-requests-limit: 10 diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..f4a1eba6c --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,19 @@ +--- +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 180 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 14 +# Issues with these labels will never be considered stale +exemptLabels: + - WIP + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: This issue has been closed due to no activity please reopen if you believe this is still an issue. diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml new file mode 100644 index 000000000..74d5e75bb --- /dev/null +++ b/.github/workflows/ci-build.yml @@ -0,0 +1,139 @@ +--- +on: + pull_request: + +permissions: + contents: read + +concurrency: + group: ci-build-${{ github.ref }} + cancel-in-progress: true + +jobs: + generate-matrix: + runs-on: ubuntu-latest + outputs: + x64_oses: ${{ steps.set-matrix.outputs.x64_oses }} + arm64_oses: ${{ steps.set-matrix.outputs.arm64_oses }} + steps: + - name: Checkout + uses: actions/checkout@main + - name: Set matrix + id: set-matrix + run: | + # arm64 exclusions: no aarch64 pkrvars exist for these OS versions + X64=$(ruby -r yaml -r json -e "puts YAML.load_file('builds.yml')['public'].reject { |o| o.start_with?('amazonlinux') }.to_json") + ARM64=$(ruby -r yaml -r json -e "excl=%w[almalinux-8 oraclelinux-8 rockylinux-8]; puts YAML.load_file('builds.yml')['public'].reject { |o| o.start_with?('amazonlinux') || excl.include?(o) }.to_json") + echo "x64_oses=${X64}" >> "$GITHUB_OUTPUT" + echo "arm64_oses=${ARM64}" >> "$GITHUB_OUTPUT" + ci-lint: + uses: ./.github/workflows/ci-lint.yml + secrets: inherit + + packer-lint: + uses: ./.github/workflows/packer-lint.yml + secrets: inherit + + packer-iso-check: + uses: ./.github/workflows/packer-iso-url-checker.yml + + pkr-bld-amazonlinux-x64: + uses: ./.github/workflows/pkr-bld-amazonlinux-x64.yml + secrets: inherit + + pkr-bld-amazonlinux-arm64: + uses: ./.github/workflows/pkr-bld-amazonlinux-arm64.yml + secrets: inherit + + pkr-bld-hyperv-x64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-hyperv-x64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.x64_oses }} + + pkr-bld-parallels-x64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-parallels-x64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.x64_oses }} + + pkr-bld-parallels-arm64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-parallels-arm64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.arm64_oses }} + + pkr-bld-qemu-x64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-qemu-x64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.x64_oses }} + + pkr-bld-qemu-arm64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-qemu-arm64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.arm64_oses }} + + pkr-bld-utm-x64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-utm-x64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.x64_oses }} + + pkr-bld-utm-arm64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-utm-arm64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.arm64_oses }} + + pkr-bld-virtualbox-x64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-virtualbox-x64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.x64_oses }} + + pkr-bld-virtualbox-arm64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-virtualbox-arm64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.arm64_oses }} + + pkr-bld-vmware-x64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-vmware-x64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.x64_oses }} + + pkr-bld-vmware-arm64: + needs: generate-matrix + uses: ./.github/workflows/pkr-bld-vmware-arm64.yml + secrets: inherit + with: + os_matrix: ${{ needs.generate-matrix.outputs.arm64_oses }} + + check_jobs_pass: + if: always() + needs: + - ci-lint + - packer-lint + - packer-iso-check + + runs-on: Ubuntu-latest + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + allowed-failures: + allowed-skips: ${{ toJSON(needs) }} + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml new file mode 100644 index 000000000..7ae2e31df --- /dev/null +++ b/.github/workflows/ci-lint.yml @@ -0,0 +1,41 @@ +--- +on: + workflow_call: + +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 + + 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 + + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@main + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/.github/workflows/packer-iso-url-checker.yml b/.github/workflows/packer-iso-url-checker.yml new file mode 100644 index 000000000..23af9e9ab --- /dev/null +++ b/.github/workflows/packer-iso-url-checker.yml @@ -0,0 +1,42 @@ +--- +on: + workflow_call: + schedule: + - cron: '0 0 1 * *' + +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" diff --git a/.github/workflows/packer-lint.yml b/.github/workflows/packer-lint.yml new file mode 100644 index 000000000..69e5eaf3b --- /dev/null +++ b/.github/workflows/packer-lint.yml @@ -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 diff --git a/.github/workflows/pkr-bld-amazonlinux-arm64.yml b/.github/workflows/pkr-bld-amazonlinux-arm64.yml new file mode 100644 index 000000000..162003057 --- /dev/null +++ b/.github/workflows/pkr-bld-amazonlinux-arm64.yml @@ -0,0 +1,57 @@ +--- +on: + workflow_call: + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + aarch64: + runs-on: [self-hosted, ARM64, virtualbox] + strategy: + fail-fast: false + matrix: + os: + - amazonlinux-2023 + 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: 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: 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 + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(VBoxManage list vms | grep ${{ matrix.os }} | cut -d " " -f 1)" + echo "VM Name: $VM" + echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-aarch64 + VBoxManage controlvm $VM poweroff + sleep 1 + vboxmanage unregistervm $VM --delete + sleep 2 diff --git a/.github/workflows/pkr-bld-amazonlinux-x64.yml b/.github/workflows/pkr-bld-amazonlinux-x64.yml new file mode 100644 index 000000000..c0e861ca1 --- /dev/null +++ b/.github/workflows/pkr-bld-amazonlinux-x64.yml @@ -0,0 +1,78 @@ +--- +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: 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 + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(VBoxManage list vms | grep ${{ matrix.os }} | cut -d " " -f 1)" + echo "VM Name: $VM" + echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-aarch64 + VBoxManage controlvm $VM poweroff + sleep 1 + vboxmanage unregistervm $VM --delete + sleep 2 diff --git a/.github/workflows/pkr-bld-hyperv-x64.yml b/.github/workflows/pkr-bld-hyperv-x64.yml new file mode 100644 index 000000000..23579064e --- /dev/null +++ b/.github/workflows/pkr-bld-hyperv-x64.yml @@ -0,0 +1,74 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + x86_64: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - hyperv-iso + steps: + - name: Checkout + uses: actions/checkout@main + - name: Install Chef + uses: actionshub/chef-install@3.0.0 + - name: Setup Packer + uses: hashicorp/setup-packer@main + with: + version: latest + - name: Install Bento + run: | + 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 + $adapter = (Get-NetAdapter | Where-Object { $_.Status -eq "Up" })[0].Name + New-VMSwitch -Name "bento" -NetAdapterName $adapter -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: Bento Test + run: | + chef shell-init powershell + bento test + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-hyperv-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 + - name: Remove VM in case of canceled job + if: cancelled() + shell: pwsh + run: | + $vm = Get-VM | Where-Object { $_.Name -like "*${{ matrix.os }}*" } | Select-Object -First 1 + if ($vm) { + Write-Host "Stopping and removing VM: $($vm.Name)" + Stop-VM -Name $vm.Name -Force -TurnOff -ErrorAction SilentlyContinue + Start-Sleep -Seconds 2 + Remove-VM -Name $vm.Name -Force -ErrorAction SilentlyContinue + } diff --git a/.github/workflows/pkr-bld-parallels-arm64.yml b/.github/workflows/pkr-bld-parallels-arm64.yml new file mode 100644 index 000000000..48080c6c4 --- /dev/null +++ b/.github/workflows/pkr-bld-parallels-arm64.yml @@ -0,0 +1,62 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + aarch64: + runs-on: [self-hosted, ARM64, parallels] + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - parallels-iso + 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: 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/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-aarch64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-parallels-aarch64" + path: | + builds/testing_passed/aarch64/*.box + builds/testing_passed/aarch64/*.json + overwrite: true + retention-days: 10 + compression-level: 0 # no compression + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(prlctl list -a | grep ${{ matrix.os }} | cut -d " " -f 1)" + echo "VM Name: $VM" + echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-aarch64 + prlctl stop "$VM" --kill 2> /dev/null + sleep 1 + prlctl delete "$VM" 2> /dev/null + sleep 2 diff --git a/.github/workflows/pkr-bld-parallels-x64.yml b/.github/workflows/pkr-bld-parallels-x64.yml new file mode 100644 index 000000000..bcff27c3f --- /dev/null +++ b/.github/workflows/pkr-bld-parallels-x64.yml @@ -0,0 +1,61 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + x86_64: + runs-on: [self-hosted, X64, parallels] + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - parallels-iso + steps: + - name: Checkout + uses: actions/checkout@main +# - name: Setup Packer +# uses: hashicorp/setup-packer@main +# with: +# version: latest + - 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/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-x86_64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-parallels-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 + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(prlctl list -a | grep ${{ matrix.os }} | cut -d " " -f 1)" + echo "VM Name: $VM" + echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-amd64 + prlctl stop "$VM" --kill 2> /dev/null + sleep 1 + prlctl delete "$VM" 2> /dev/null + sleep 2 diff --git a/.github/workflows/pkr-bld-qemu-arm64.yml b/.github/workflows/pkr-bld-qemu-arm64.yml new file mode 100644 index 000000000..b0a883c23 --- /dev/null +++ b/.github/workflows/pkr-bld-qemu-arm64.yml @@ -0,0 +1,83 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + aarch64: + runs-on: [self-hosted, ARM64, qemu] + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - qemu + steps: + - name: Checkout + uses: actions/checkout@main +# - 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 +# - name: Enable KVM +# run: | +# echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules +# sudo udevadm control --reload-rules +# sudo udevadm trigger --name-match=kvm +# sudo usermod -aG kvm $USER +# sudo usermod -aG libvirt $USER +# sudo chmod o+rw /var/run/libvirt/libvirt-sock +# sudo systemctl start libvirtd +# sudo systemctl status libvirtd +# - name: Install Chef +# uses: actionshub/chef-install@3.0.0 +# - 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/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-aarch64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test qemu + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-qemu-aarch64" + path: | + builds/testing_passed/aarch64/*.box + builds/testing_passed/aarch64/*.json + overwrite: true + retention-days: 10 + compression-level: 0 # no compression + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(virsh list --all | grep '${{ matrix.os }}' | awk '{print $2}')" + echo "VM Name: $VM" + virsh destroy "$VM" 2>/dev/null || true + sleep 2 + virsh undefine "$VM" --remove-all-storage 2>/dev/null || true diff --git a/.github/workflows/pkr-bld-qemu-x64.yml b/.github/workflows/pkr-bld-qemu-x64.yml new file mode 100644 index 000000000..c294e26a6 --- /dev/null +++ b/.github/workflows/pkr-bld-qemu-x64.yml @@ -0,0 +1,88 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +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: ${{ fromJson(inputs.os_matrix) }} + provider: + - qemu + steps: + - name: Checkout + uses: actions/checkout@main + - 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 + - name: Enable KVM + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + sudo usermod -aG kvm $USER + sudo usermod -aG libvirt $USER + sudo chmod o+rw /var/run/libvirt/libvirt-sock + sudo systemctl start libvirtd + sudo systemctl status libvirtd + - name: Install Chef + uses: actionshub/chef-install@3.0.0 + - 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: | + 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)" + bento build -o ${{ matrix.provider }}.vm os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" + ls -alh builds/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-x86_64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test qemu + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-qemu-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 + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(virsh list --all | grep '${{ matrix.os }}' | awk '{print $2}')" + echo "VM Name: $VM" + virsh destroy "$VM" 2>/dev/null || true + sleep 2 + virsh undefine "$VM" --remove-all-storage 2>/dev/null || true diff --git a/.github/workflows/pkr-bld-utm-arm64.yml b/.github/workflows/pkr-bld-utm-arm64.yml new file mode 100644 index 000000000..b04e9bb17 --- /dev/null +++ b/.github/workflows/pkr-bld-utm-arm64.yml @@ -0,0 +1,76 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + aarch64: + runs-on: [self-hosted, ARM64, utm] + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - utm-iso + steps: + - name: Checkout + uses: actions/checkout@main +# - name: Install UTM vagrant` +# run: | +# brew tap hashicorp/tap +# brew update +# brew install --cask hashicorp/tap/hashicorp-vagrant +# brew install utm +# vagrant plugin install vagrant_utm +# - name: Setup Packer +# if: steps.verify-changed-files.outputs.files_changed == 'true' +# uses: hashicorp/setup-packer@main +# with: +# version: latest +# - name: Install Chef +# uses: actionshub/chef-install@3.0.0 +# - 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/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-aarch64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-utm-aarch64" + path: | + builds/testing_passed/aarch64/*.box + builds/testing_passed/aarch64/*.json + overwrite: true + retention-days: 10 + compression-level: 0 # no compression + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(utmctl list -a | grep ${{ matrix.os }} | cut -d " " -f 1)" + echo "VM Name: $VM" + echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-aarch64 + utmctl stop "$VM" + sleep 1 + utmctl delete "$VM" + sleep 2 diff --git a/.github/workflows/pkr-bld-utm-x64.yml b/.github/workflows/pkr-bld-utm-x64.yml new file mode 100644 index 000000000..8db4e5a10 --- /dev/null +++ b/.github/workflows/pkr-bld-utm-x64.yml @@ -0,0 +1,80 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # PACKER_LOG: 1 + +jobs: + x86_64: + runs-on: [self-hosted, X64, utm] + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - utm-iso + steps: + - name: Checkout + uses: actions/checkout@main +# - name: Install UTM vagrant` +# run: | +# brew tap hashicorp/tap +# brew update +# brew install --cask hashicorp/tap/hashicorp-vagrant +# brew install utm +# vagrant plugin install vagrant_utm +# - name: Setup Packer +# if: steps.verify-changed-files.outputs.files_changed == 'true' +# uses: hashicorp/setup-packer@main +# with: +# version: latest +# - name: Install Chef +# uses: actionshub/chef-install@3.0.0 +# - 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 --vars 'ssh_timeout=60m' os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl" + ls -alh builds/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-x86_64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-utm-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 + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(utmctl list -a | grep ${{ matrix.os }} | cut -d " " -f 1)" + echo "VM Name: $VM" + echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-aarch64 + utmctl stop "$VM" + sleep 1 + utmctl delete "$VM" + sleep 2 diff --git a/.github/workflows/pkr-bld-virtualbox-arm64.yml b/.github/workflows/pkr-bld-virtualbox-arm64.yml new file mode 100644 index 000000000..e9803bd74 --- /dev/null +++ b/.github/workflows/pkr-bld-virtualbox-arm64.yml @@ -0,0 +1,62 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + aarch64: + runs-on: [self-hosted, ARM64, virtualbox] + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - virtualbox-iso + 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: 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/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-aarch64._metadata.json + - 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 + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(VBoxManage list vms | grep ${{ matrix.os }} | cut -d " " -f 1)" + echo "VM Name: $VM" + echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-aarch64 + VBoxManage controlvm $VM poweroff + sleep 1 + vboxmanage unregistervm $VM --delete + sleep 2 diff --git a/.github/workflows/pkr-bld-virtualbox-x64.yml b/.github/workflows/pkr-bld-virtualbox-x64.yml new file mode 100644 index 000000000..584833f3e --- /dev/null +++ b/.github/workflows/pkr-bld-virtualbox-x64.yml @@ -0,0 +1,83 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +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: ${{ fromJson(inputs.os_matrix) }} + provider: + - virtualbox-iso + steps: + - name: Checkout + uses: actions/checkout@main + - 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.2 + - name: Install Chef + uses: actionshub/chef-install@3.0.0 + - 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: | + 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)" + 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/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-x86_64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + export LOGNAME=$USER + 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 + - name: Remove VM in case of canceled job + if: cancelled() + run: | + VM="$(VBoxManage list vms | grep ${{ matrix.os }} | cut -d " " -f 1)" + echo "VM Name: $VM" + echo Powering off and deleting any existing VMs named ${{ matrix.os }}*-aarch64 + VBoxManage controlvm $VM poweroff + sleep 1 + vboxmanage unregistervm $VM --delete + sleep 2 diff --git a/.github/workflows/pkr-bld-vmware-arm64.yml b/.github/workflows/pkr-bld-vmware-arm64.yml new file mode 100644 index 000000000..1a5e02528 --- /dev/null +++ b/.github/workflows/pkr-bld-vmware-arm64.yml @@ -0,0 +1,78 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + aarch64: + runs-on: [self-hosted, ARM64, vmware] + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - vmware-iso + 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: 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/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-aarch64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-parallels-aarch64" + path: | + builds/testing_passed/aarch64/*.box + builds/testing_passed/aarch64/*.json + overwrite: true + retention-days: 10 + compression-level: 0 # no compression + - name: Remove VM in case of canceled job + if: cancelled() + run: | + # Set your VM directory path + VM_DIR="$HOME/Documents/Virtual Machines.localized" + # VM name to search for (case-sensitive) + TARGET_VM_NAME="${{ matrix.os }}" + # List all VMs + echo "Listing all VMs in $VM_DIR..." + VM_PATHS=$(find "$VM_DIR" -name "*.vmx") + # Loop through each VM and match by name + for VMX in $VM_PATHS; do + if grep -q "$TARGET_VM_NAME" <<< "$VMX"; then + echo "Found VM: $VMX" + # Stop the VM + echo "Stopping VM..." + vmrun stop "$VMX" soft + # Wait a bit to ensure it's stopped + sleep 5 + # Delete the VM directory + VM_FOLDER=$(dirname "$VMX") + echo "Deleting VM folder: $VM_FOLDER" + rm -rf "$VM_FOLDER" + echo "VM '$TARGET_VM_NAME' has been stopped and deleted." + fi + done diff --git a/.github/workflows/pkr-bld-vmware-x64.yml b/.github/workflows/pkr-bld-vmware-x64.yml new file mode 100644 index 000000000..295859d56 --- /dev/null +++ b/.github/workflows/pkr-bld-vmware-x64.yml @@ -0,0 +1,78 @@ +--- +on: + workflow_call: + inputs: + os_matrix: + required: true + type: string + +permissions: + contents: read + +env: + PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + # PACKER_LOG: "1" + +jobs: + x86_64: + runs-on: [self-hosted, X64, vmware] + strategy: + fail-fast: false + matrix: + os: ${{ fromJson(inputs.os_matrix) }} + provider: + - vmware-iso + 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: 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/build_complete/ + cat builds/build_complete/${{ matrix.os }}*-x86_64._metadata.json + - name: Bento Test + run: | + eval "$(chef shell-init bash)" + bento test + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: "${{ matrix.os }}-parallels-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 + - name: Remove VM in case of canceled job + if: cancelled() + run: | + # Set your VM directory path + VM_DIR="$HOME/Documents/Virtual Machines.localized" + # VM name to search for (case-sensitive) + TARGET_VM_NAME="${{ matrix.os }}" + # List all VMs + echo "Listing all VMs in $VM_DIR..." + VM_PATHS=$(find "$VM_DIR" -name "*.vmx") + # Loop through each VM and match by name + for VMX in $VM_PATHS; do + if grep -q "$TARGET_VM_NAME" <<< "$VMX"; then + echo "Found VM: $VMX" + # Stop the VM + echo "Stopping VM..." + vmrun stop "$VMX" soft + # Wait a bit to ensure it's stopped + sleep 5 + # Delete the VM directory + VM_FOLDER=$(dirname "$VMX") + echo "Deleting VM folder: $VM_FOLDER" + rm -rf "$VM_FOLDER" + echo "VM '$TARGET_VM_NAME' has been stopped and deleted." + fi + done diff --git a/.gitignore b/.gitignore index 02f8fc944..b85965350 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,24 @@ -bin/ .bundle/ -iso/ +**/builds/ +*.iso *.box +*.ova +*.ovf +*.vmdk +*.vdi +*.qcow2 +*.log virtualfloppy.vfd +packer_cache/ +packer.log +.DS_Store +Gemfile.lock +bootstrap.sh +Berksfile.lock +*.variables.json +/builds/ +.kitchen +.kitchen.yml +kitchen.yml +*.metadata.json +bento-*.gem diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 000000000..93a568f3b --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,6 @@ +--- +config: + line-length: false # MD013 +ignores: + - .github/copilot-instructions.md + - AGENTS.md diff --git a/.rspec b/.rspec new file mode 100644 index 000000000..4e33a322b --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--require spec_helper +--color +--format documentation diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 000000000..076f6a9b9 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,3 @@ +# ~/.shellcheckrc +# disable=SC2059,SC2034 # Disable individual error codes +# disable=SC1090-SC1100 # Disable a range of error codes diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..4673b5c03 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,280 @@ +# Bento Repository - Agent Instructions + +This repository contains the Bento project, which provides: +1. **Ruby CLI Wrapper**: A Ruby gem (`bento`) that wraps Hashicorp Packer for building Vagrant boxes +2. **Packer Templates**: HCL-based Packer templates for building Vagrant base boxes across multiple operating systems and providers + +## Repository Overview + +### Ruby Component (CLI Wrapper) +- **Language**: Ruby 3.0+ +- **Main Executable**: `bin/bento` +- **Library Code**: `lib/bento/` +- **Key Features**: Build, test, upload, list, and normalize Vagrant boxes +- **Dependencies**: mixlib-shellout, Packer, Vagrant + +### Packer Component (Box Definitions) +- **Language**: HCL (HashiCorp Configuration Language) +- **Templates Directory**: `packer_templates/` +- **OS Variable Files**: `os_pkrvars/` (organized by OS family) +- **Supported Providers**: VirtualBox, VMware, Parallels, UTM, QEMU, Hyper-V +- **Supported Architectures**: x86_64, aarch64 + +## Code Change Requirements + +### For ALL Changes to This Repository: + +#### 1. Linting Requirements +Before committing any changes, you **MUST** run the following linters based on the files modified: + +**Ruby Files** (`*.rb`, `Rakefile`, `*.gemspec`): +```bash +bundle install +bundle exec cookstyle -a . +``` + +**Markdown Files** (`*.md`): +```bash +# Markdown linting is performed via GitHub Actions +# Local testing not required but verify links work +``` + +**YAML Files** (`*.yml`, `*.yaml`): +```bash +# YAML linting is performed via GitHub Actions +# Ensure valid YAML syntax +``` + +**Shell Scripts** (`*.sh`): +```bash +shellcheck *.sh +``` + +**PowerShell Scripts** (`*.ps1`): +```bash +# PowerShell linting is performed via GitHub Actions +``` + +**Packer Templates** (`*.pkr.hcl`, `*.pkrvars.hcl`): +```bash +cd /path/to/bento +packer init -upgrade ./packer_templates +packer validate -var-file=os_pkrvars//