test-kitchen / kitchen-vagrant

A Test Kitchen Driver for Vagrant
Other
348 stars 189 forks source link

add vagrant architecture support #491

Closed Stromweld closed 4 months ago

Stromweld commented 5 months ago

Description

added vagrant cpu architecture support when specifying boxes and providers https://developer.hashicorp.com/vagrant/vagrant-cloud/boxes/architecture https://app.vagrantup.com/bento/boxes/ubuntu-23.10

When not specified Vagrant defaults to the system CPU architecture for box downloads

Check List

Stromweld commented 5 months ago

Not sure what is going on with that last failing spec test.

tas50 commented 5 months ago

Without really digging into things too much here it looks like winrm is failing, but the winrm support we have here is 9 years old and probably not necessary anymore. Vagrant natively supports that. I'm not sure we need the plugin anymore. That should probably all get refactored away and a major version bump of this cut.

Stromweld commented 5 months ago

Tested this as working. Test setup M3 macbook pro kitchen file without box_arch specified:

❯ kitchen converge almalinux-9
-----> Starting Test Kitchen (v3.6.0)
-----> Creating <default-almalinux-9>...
       The box 'bento/almalinux-9' does not exist. Please double check and
       try again. You can see the boxes that are installed with
       `vagrant box list`.
       There are no installed boxes! Use `vagrant box add` to add some.
       Bringing machine 'default' up with 'parallels' provider...
       ==> default: Box 'bento/almalinux-9' could not be found. Attempting to find and install...
           default: Box Provider: parallels
           default: Box Version: >= 0
       ==> default: Loading metadata for box 'bento/almalinux-9'
           default: URL: https://vagrantcloud.com/api/v2/vagrant/bento/almalinux-9
       ==> default: Adding box 'bento/almalinux-9' (v202401.31.0) for provider: parallels (arm64)
           default: Downloading: https://vagrantcloud.com/bento/boxes/almalinux-9/versions/202401.31.0/providers/parallels/arm64/vagrant.box
==> default: Successfully added box 'bento/almalinux-9' (v202401.31.0) for 'parallels (arm64)'!
       ==> default: Registering VM image from the base box 'bento/almalinux-9'...
       ==> default: Creating new virtual machine as a linked clone of the box image...
==> default: Unregistering the box VM image...
       ==> default: Setting the default configuration for VM...
       ==> default: Checking if box 'bento/almalinux-9' version '202401.31.0' is up to date...
       ==> default: Setting the name of the VM: default-almalinux-9_default_1707243269841_47715
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 0: shared
           default: Adapter 1: bridged
       ==> default: Clearing any previously set network interfaces...
       ==> default: Booting VM...
       ==> default: Waiting for machine to boot. This may take a few minutes...
           default: SSH address: 10.211.55.38:22
           default: SSH username: vagrant
           default: SSH auth method: private key
           default: 
           default: Vagrant insecure key detected. Vagrant will automatically replace
           default: this with a newly generated keypair for better security.
           default: 
           default: Inserting generated public key within guest...
           default: Removing insecure key from the guest if it's present...
           default: Key inserted! Disconnecting and reconnecting using new SSH key...
       ==> default: Machine booted and ready!
❯ vagrant box list
bento/almalinux-9 (parallels, 202401.31.0, (arm64))

Same machine specifying box_arch: amd64:

❯ kitchen create almalinux-9
-----> Starting Test Kitchen (v3.6.0)
-----> Creating <default-almalinux-9>...
       The box 'bento/almalinux-9' does not exist. Please double check and
       try again. You can see the boxes that are installed with
       `vagrant box list`.
       There are no installed boxes! Use `vagrant box add` to add some.
       Bringing machine 'default' up with 'parallels' provider...
       ==> default: Box 'bento/almalinux-9' could not be found. Attempting to find and install...
           default: Box Provider: parallels
           default: Box Version: >= 0
       ==> default: Loading metadata for box 'bento/almalinux-9'
           default: URL: https://vagrantcloud.com/api/v2/vagrant/bento/almalinux-9
       ==> default: Adding box 'bento/almalinux-9' (v202401.31.0) for provider: parallels (amd64)
           default: Downloading: https://vagrantcloud.com/bento/boxes/almalinux-9/versions/202401.31.0/providers/parallels/amd64/vagrant.box
==> default: Successfully added box 'bento/almalinux-9' (v202401.31.0) for 'parallels (amd64)'!
       ==> default: Registering VM image from the base box 'bento/almalinux-9'...
       ==> default: Creating new virtual machine as a linked clone of the box image...
==> default: Unregistering the box VM image...
       ==> default: Setting the default configuration for VM...
       ==> default: Checking if box 'bento/almalinux-9' version '202401.31.0' is up to date...
       ==> default: Setting the name of the VM: default-almalinux-9_default_1707243947586_85790
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 0: shared
           default: Adapter 1: bridged
       ==> default: Clearing any previously set network interfaces...
       ==> default: Booting VM...
       There was an error while command execution. The command and stderr is shown below.

       Command: ["/usr/local/bin/prlctl", "start", "6b21a851-096c-4f0b-81ab-be9794255a45"]

       Stderr: Failed to start the VM: Unable to start "default-almalinux-9_default_1707243947586_85790" because your Mac is equipped with the Apple M series chip that does not support Intel-based operating systems. To create a compatible virtual machine, use an ISO or VHDX image file with an ARM-based operating system.
❯ vagrant box list
bento/almalinux-9 (parallels, 202401.31.0, (amd64))
Stromweld commented 4 months ago

@tas50 would you be able to cut a new major release of this driver?

tas50 commented 4 months ago

I was planning to do a new one when I get into my office this morning

Stromweld commented 4 months ago

cool thanks