Skip to content

Commit

Permalink
vagrant cloud cpu architecture support added (#1546)
Browse files Browse the repository at this point in the history
* vagrant cloud cpu architecture support added
  • Loading branch information
Stromweld committed Feb 5, 2024
1 parent 82435a5 commit 7bbfea4
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 360 deletions.
79 changes: 43 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@
***Note:**
Markdown table generated at <https://www.tablesgenerator.com/markdown_tables#>

| | hyperv<br>x86_64 | parallels<br>x86_64 | parallels<br>aarch64 | qemu<br>x86_64 | qemu<br>aarch64 | virtualbox<br>x86_64 | virtualbox<br>aarch64 | vmware<br>x86_64 | vmware<br>aarch64 |
|:-----------------:|:---:|:---:|:--------------------:|:---:|:---:|:---:|:---:|:---:|:---:|
| almalinux-8 | | x | | x | | x | | x | |
| almalinux-9 | | x | x | | | x | | x | x |
| amazonlinux-2 | | na | na | | | | na | | na |
| amazonlinux-2023 | na | na | na | na | na | na | na | na | na |
| centos-7 | | x | | x | | x | | x | |
| centos-stream-8 | | x | | x | | x | | x | |
| centos-stream-9 | | | x | | | | | | |
| debian-11 | | x | x | | | x | | x | |
| debian-12 | | x | x | | | x | | x | x |
| fedora-38 | | x | | x | | x | | x | x |
| fedora-39 | | | | | | | | | |
| freebsd-12 | | | | | | x | | x | |
| freebsd-13 | | | | | | x | | x | |
| opensuse-leap-15 | | x | | x | | x | | x | |
| oraclelinux-7 | | x | | x | | x | | x | |
| oraclelinux-8 | | | | x | | x | | x | |
| oraclelinux-9 | | x | x | | | x | | x | |
| rhel-7 | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed |
| rhel-8 | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed |
| rhel-9 | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed |
| rockylinux-8 | | x | | x | | x | | x | |
| rockylinux-9 | | x | | | | x | | x | x |
| sles-12 | license<br>needed | license<br>needed | na | license<br>needed | na | license<br>needed | na | license<br>needed | na |
| sles-13 | license<br>needed | license<br>needed | na | license<br>needed | na | license<br>needed | na | license<br>needed | na |
| solaris-11 | license<br>needed | license<br>needed | na | license<br>needed | na | license<br>needed | na | license<br>needed | na |
| ubuntu-20.04 | | x | x | | | x | | x | x |
| ubuntu-22.04 | | x | | x | | x | | x | |
| ubuntu-23.10 | | | | | | | | | |
| windows-10 | | x | na | | na | x | na | | na |
| windows-11 | | x | na | | na | x | na | | na |
| windows-2016 | | x | na | | na | x | na | | na |
| windows-2019 | | x | na | | na | x | na | | na |
| windows-2022 | | x | na | | na | x | na | | na |
| | hyperv<br>x86_64 | parallels<br>x86_64 | parallels<br>aarch64 | qemu<br>x86_64 | qemu<br>aarch64 | virtualbox<br>x86_64 | virtualbox<br>aarch64 | vmware<br>x86_64 | vmware<br>aarch64 |
|:----------------:|:---:|:-------------------:|:--------------------:|:---:|:---:|:--------------------:|:---:|:-----------------:|:-----------------:|
| almalinux-8 | | x | | x | | x | | x | |
| almalinux-9 | | x | x | | | x | | x | x |
| amazonlinux-2 | | na | na | | | | na | | na |
| amazonlinux-2023 | na | na | na | na | na | na | na | na | na |
| centos-7 | | x | | x | | x | | x | |
| centos-stream-8 | | x | | x | | x | | x | |
| centos-stream-9 | | | x | | | | | | |
| debian-11 | | x | x | | | x | | x | |
| debian-12 | | x | x | | | x | | x | x |
| fedora-38 | | x | | x | | x | | x | x |
| fedora-39 | | | | | | | | | |
| freebsd-13 | | | | | | x | | x | x |
| freebsd-14 | | | | | | x | | x | |
| opensuse-leap-15 | | x | | x | | x | | x | |
| oraclelinux-7 | | x | | x | | x | | x | |
| oraclelinux-8 | | | | x | | x | | x | |
| oraclelinux-9 | | x | x | | | x | | x | |
| rhel-7 | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed |
| rhel-8 | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed |
| rhel-9 | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed | license<br>needed |
| rockylinux-8 | | x | | x | | x | | x | |
| rockylinux-9 | | x | | | | x | | x | x |
| sles-12 | license<br>needed | license<br>needed | na | license<br>needed | na | license<br>needed | na | license<br>needed | na |
| sles-13 | license<br>needed | license<br>needed | na | license<br>needed | na | license<br>needed | na | license<br>needed | na |
| solaris-11 | license<br>needed | license<br>needed | na | license<br>needed | na | license<br>needed | na | license<br>needed | na |
| ubuntu-20.04 | | x | x | | | x | | x | x |
| ubuntu-22.04 | | x | | x | | x | | x | |
| ubuntu-23.10 | | x | x | | | x | | x | x |
| windows-10 | | x | na | | na | x | na | | na |
| windows-11 | | x | na | | na | x | na | | na |
| windows-2016 | | x | na | | na | x | na | | na |
| windows-2019 | | x | na | | na | x | na | | na |
| windows-2022 | | x | na | | na | x | na | | na |

### Todo

Expand All @@ -54,7 +54,14 @@ Markdown table generated at <https://www.tablesgenerator.com/markdown_tables#>
- Create CD pipeline to build and upload new versions of vagrant boxes once every 3 months with the latest patches
- Added ability to configure bento upload of private or public boxes in builds.yml, defaults to private

## [unreleased] (2024-02-01)
## [unreleased] (2024-02-05)

## [v4.0.0] (2024-02-05)

- Added Vagrant Cloud architecture flags so amd64 and arm64 boxes can live under the same cloud box
- Setting amd64 as default architecture for uploads, configurable in the builds.yml file
- Update descriptions mentioning chef to progress chef
- Update README.md to reflect vagrant version for new architecture support

## [v3.2.2] (2024-02-01)

Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Bento is a project that encapsulates [Packer](https://www.packer.io/) templates

***NOTE:**

- Vagrant 2.4.0+ is required for new cpu archetecture support
- Virutalbox 6.x requires disabling nat config that allows vbox 7.x guests to connect to the host. To use comment out lines #161 and #162 in bento/packer_templates/pkr-variables.pkr.hcl or add variable `vboxmanage = []` to os_pkrvars files.
- When running packer build command the output directory is relative to the working directory the command is currently running in. Suggest running packer build commands from bento root directory for build working files to be placed in bento/builds/(build_name) directory by default. If the output_directory variable isn't overwritten a directory called builds/(build_name) will be created in the current working directory that you are running the command from

Expand All @@ -28,17 +29,18 @@ end
#### Requirements

- [Packer](https://www.packer.io/) >= 1.7.0
- [Vagrant](https://www.vagrantup.com/)
- [Vagrant](https://www.vagrantup.com/) >= 2.4.0
- At least one of the following virtualization providers:
- [VirtualBox](https://www.virtualbox.org/)
- [VMware Fusion](https://www.vmware.com/products/fusion.html)
- [VMware Workstation](https://www.vmware.com/products/workstation-pro.html)
- [Parallels Desktop Pro](https://www.parallels.com/products/desktop/)*2 also requires [Parallels Virtualization SDK](https://www.parallels.com/products/desktop/download/) for versions < 19.x
- [qemu](https://www.qemu.org/) *1
- [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/about/) *1
- [VirtualBox](https://www.virtualbox.org/)*2
- [VMware Fusion](https://www.vmware.com/products/fusion.html)*2
- [VMware Workstation](https://www.vmware.com/products/workstation-pro.html)*2
- [Parallels Desktop Pro](https://www.parallels.com/products/desktop/) also requires [Parallels Virtualization SDK](https://www.parallels.com/products/desktop/download/) for versions < 19.x
- [qemu](https://www.qemu.org/) *1 *2
- [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/about/) *1 *2

*1**NOTE:** support for these providers is considered experimental and corresponding Vagrant Cloud images may or may not exist.
*2**NOTE:** AARCH64 or ARM64 support is only guaranteed through parallels provider.
*1 **NOTE:** support for these providers is considered experimental and corresponding Vagrant Cloud images may or may not exist.

*2 **NOTE:** AARCH64 or ARM64 support is a work in progress only guaranteed through parallels and vmware provider.

### Using `bento` executable

Expand Down Expand Up @@ -196,7 +198,7 @@ These basebox templates were converted from [veewee](https://github.com/jedi4eve
- Author: Corey Hemminger ([[email protected]](mailto:[email protected]))

```text
Copyright 2012-2023, Progress Software, Inc. (<[email protected]>)
Copyright 2012-2024, Progress Software, Inc. (<[email protected]>)
Copyright 2011-2012, Tim Dysinger (<[email protected]>)
Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
37 changes: 4 additions & 33 deletions builds.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
vagrant_cloud_account: 'bento'

default_architectures:
- 'x86_64'
- 'amd64'

public:
- 'almalinux-8'
- 'almalinux-9'
Expand All @@ -24,28 +28,6 @@ public:
- 'ubuntu-20.04'
- 'ubuntu-22.04'
- 'ubuntu-23.10'
- 'almalinux-8-arm64'
- 'almalinux-9-arm64'
- 'amazon-2-arm64'
- 'amazon-2023-arm64'
- 'centos-7-arm64'
- 'centos-stream-8-arm64'
- 'centos-stream-9-arm64'
- 'debian-11-arm64'
- 'debian-12-arm64'
- 'fedora-38-arm64'
- 'fedora-39-arm64'
- 'freebsd-13-arm64'
- 'freebsd-14-arm64'
- 'opensuse-leap-15-arm64'
- 'oracle-7-arm64'
- 'oracle-8-arm64'
- 'oracle-9-arm64'
- 'rockylinux-8-arm64'
- 'rockylinux-9-arm64'
- 'ubuntu-20.04-arm64'
- 'ubuntu-22.04-arm64'
- 'ubuntu-23.10-arm64'

# slug box name: text string from standard box name to match (generally the same)
slugs:
Expand All @@ -63,17 +45,6 @@ slugs:
'oracle-9': 'oracle-9'
'rockylinux-8': 'rockylinux-8'
'rockylinux-9': 'rockylinux-9'
'almalinux-8-arm64': 'almalinux-8'
'almalinux-9-arm64': 'almalinux-9'
'centos-7-arm64': 'centos-7'
'debian-12-arm64': 'debian-12'
'debian-11-arm64': 'debian-11'
'fedora-latest-arm64': 'fedora-39'
'oracle-7-arm64': 'oracle-7'
'oracle-8-arm64': 'oracle-8'
'oracle-9-arm64': 'oracle-9'
'rockylinux-8-arm64': 'rockylinux-8'
'rockylinux-9-arm64': 'rockylinux-9'

do_not_build:
- amazon
Expand Down
14 changes: 2 additions & 12 deletions lib/bento/buildmetadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ def read
attr_reader :template, :build_timestamp, :override_version, :pkr_cmd

def box_basename
temp_name = name.gsub('/', '__').split('-')
if temp_name.last == 'arm64'
temp_name.join('-')
else
(temp_name.first temp_name.size - 1).join('-')
end
name.gsub('/', '__').split('-')[0...-1].join('-')
end

def git_revision
Expand All @@ -54,12 +49,7 @@ def merged_vars
end

def name
arch = merged_vars.fetch('arch', UNKNOWN).downcase
if arch == 'aarch64' || arch == 'arm64'
"#{merged_vars.fetch('name', template)}-arm64"
else
"#{merged_vars.fetch('name', template)}-x86_64"
end
merged_vars.fetch('name', template)
end

def arch
Expand Down
9 changes: 9 additions & 0 deletions lib/bento/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'bento/normalize'
require 'bento/test'
require 'bento/upload'
require 'bento/version'

class Options
NAME = File.basename($PROGRAM_NAME).freeze
Expand Down Expand Up @@ -33,6 +34,7 @@ def self.parse(args)
normalize : normalize one or more templates
test : test one or more builds with kitchen
upload : upload and release one or more builds to Vagrant Cloud
version : prints the version of #{NAME}
COMMANDS
end

Expand All @@ -59,6 +61,13 @@ def self.parse(args)
exit(0)
},
},
version: {
parser: OptionParser.new {},
argv: proc { |_opts|
puts Bento::VERSION
exit(0)
},
},
build: {
class: BuildRunner,
parser: OptionParser.new do |opts|
Expand Down
6 changes: 3 additions & 3 deletions lib/bento/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def initialize(opts)
@dry_run = opts.dry_run
@metadata_only = opts.metadata_only
@debug = opts.debug
@only = opts.only ||= 'parallels-iso.vm,virtualbox-iso.vm,vmware-iso.vm'
@only = opts.only ||= 'parallels-iso.vm,virtualbox-iso.vm,vmware-iso.vm,qemu.vm'
@except = opts.except
@mirror = opts.mirror
@headed = opts.headed ||= false
Expand Down Expand Up @@ -64,8 +64,8 @@ def build(file)
time = Benchmark.measure do
cmd.run_command
end
if Dir.glob("../../builds/*.box").empty?
banner("Not writing metadata file since no boxes exist")
if Dir.glob("../../builds/#{template.split('-')[0...-1].join('-')}*-#{template.split('-')[-1]}.*.box").empty?
banner('Not writing metadata file since no boxes exist')
else
write_final_metadata(template, time.real.ceil)
end
Expand Down
29 changes: 14 additions & 15 deletions lib/bento/upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def upload_box(md_file)
if File.exist?(File.join('builds', prov_data['file']))
puts ''
banner("Uploading #{builds_yml['vagrant_cloud_account']}/#{md_data['box_basename']} version:#{md_data['version']} provider:#{prov}...")
upload_cmd = "vagrant cloud publish --architecture #{arch} --no-direct-upload #{builds_yml['vagrant_cloud_account']}/#{md_data['box_basename']} #{md_data['version']} #{prov} builds/#{prov_data['file']} --description '#{box_desc(md_data['box_basename'])}' --short-description '#{box_desc(md_data['box_basename'])}' --version-description '#{ver_desc(md_data)}' --force --release #{public_private_box(md_data['box_basename'])}"
upload_cmd = "vagrant cloud publish --architecture #{arch} #{default_arch(arch)} --no-direct-upload #{builds_yml['vagrant_cloud_account']}/#{md_data['box_basename']} #{md_data['version']} #{prov} builds/#{prov_data['file']} --description '#{box_desc(md_data['box_basename'])}' --short-description '#{box_desc(md_data['box_basename'])}' --version-description '#{ver_desc(md_data)}' --force --release #{public_private_box(md_data['box_basename'])}"
shellout(upload_cmd)

slug_name = lookup_slug(md_data['name'])
Expand Down Expand Up @@ -75,33 +75,32 @@ def upload_box(md_file)
#
def lookup_slug(name)
builds_yml['slugs'].each_pair do |slug, match_string|
if name.include?('arm64')
return slug if name.start_with?(match_string) && slug.include?('arm64')
else
return slug if name.start_with?(match_string) && !slug.include?('arm64')
end
return slug if name.start_with?(match_string)
end

nil
end

def public_private_box(name)
builds_yml['public'].each do |public|
if name.include?('arm64') || name.include?('aarch64')
return '--no-private' if name.start_with?(public) && public.include?('arm64')
else
return '--no-private' if name.start_with?(public) && !public.include?('arm64')
end
return '--no-private' if name.start_with?(public)
end
'--private'
end

def default_arch(architecture)
builds_yml['default_architectures'].each do |arch|
return '--default-architecture' if architecture.eql?(arch)
end
return '--private'
'--no-default-architecture'
end

def box_desc(name)
"Vanilla #{name.tr('-', ' ').capitalize} Vagrant box created with Bento by Chef"
"Vanilla #{name.tr('-', ' ').capitalize} Vagrant box created with Bento by Progress Chef"
end

def slug_desc(name)
"Vanilla #{name.tr('-', ' ').capitalize} Vagrant box created with Bento by Chef. This box will be updated with the latest releases of #{name.tr('-', ' ').capitalize} as they become available"
"Vanilla #{name.tr('-', ' ').capitalize} Vagrant box created with Bento by Progress Chef. This box will be updated with the latest releases of #{name.tr('-', ' ').capitalize} as they become available"
end

def ver_desc(md_data)
Expand All @@ -120,6 +119,6 @@ def ver_desc(md_data)
tool_versions.sort!
tool_versions << "packer: #{md_data['packer']}"

"#{md_data['box_basename'].capitalize.tr('-', ' ')} Vagrant box version #{md_data['version']} created with Bento by Chef. Built with: #{tool_versions.join(', ')}"
"#{md_data['box_basename'].capitalize.tr('-', ' ')} Vagrant box version #{md_data['version']} created with Bento by Progress Chef. Built with: #{tool_versions.join(', ')}"
end
end
2 changes: 1 addition & 1 deletion lib/bento/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Bento
VERSION = '3.2.2'.freeze
VERSION = '4.0.0'.freeze
end

0 comments on commit 7bbfea4

Please sign in to comment.