Skip to content

Architecture support (vagrant-cloud post-processor)#101

Merged
nywilken merged 1 commit intohashicorp:mainfrom
chrisroberts:architecture-support
Oct 6, 2023
Merged

Architecture support (vagrant-cloud post-processor)#101
nywilken merged 1 commit intohashicorp:mainfrom
chrisroberts:architecture-support

Conversation

@chrisroberts
Copy link
Member

@chrisroberts chrisroberts commented Sep 28, 2023

Adds architecture support to the vagrant and the vagrant-cloud post-processors.

Vagrant post-processor

Introduces a new configuration option to the vagrant post-processor:

  • architecture - string

This is an optional value that will automatically default to the host platform's architecture. The architecture value will be included within the metadata.json file of the generated box.

Also included with this changeset is support for the file builder. This was just done to make it easier for testing generated boxes.

Vagrant Cloud post-processor

Updates the API calls to use Vagrant Cloud's v2 API. The v2 API supports architecture metadata for providers and the post-processor has been updated to include architecture information. New configurations options added:

  • architecture - string
  • default_architecture - string

By default, the post-processor will read the architecture information from the metadata.json within the box. If the box metadata does not include architecture information, or the architecture needs to be overridden for some reason, it can be defined using the architecture configuration option.

The default_architecture option is used for backwards compatibility support (more information available in the Vagrant Cloud docs). If the architecture value set in default_architecture matches the architecture of the box then it will be marked as the default architecture on Vagrant Cloud.

Also adjusted the vagrant-cloud post-processor test so the artifact's IdValue matches the defined box's provider to provide a bit more clarity on the mocked API paths.

@chrisroberts chrisroberts marked this pull request as ready for review September 28, 2023 00:11
@chrisroberts chrisroberts requested a review from a team as a code owner September 28, 2023 00:11
@chrisroberts chrisroberts marked this pull request as draft September 28, 2023 00:29
@chrisroberts chrisroberts marked this pull request as ready for review September 28, 2023 00:38
@chrisroberts chrisroberts force-pushed the architecture-support branch 2 times, most recently from a415e94 to 90af3b7 Compare October 2, 2023 21:15
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisroberts I like the new approach. It clarifies how architecture and default_architecture are used and does a nice job of extracting the information from the metadata.json file. I have a few suggestions on the metadata extraction logic to help reduce some of the nil checks and not hide what is going on in each of the load metadata from Vagrant box functions.

Let me know what you think. I did not test the suggested changes as I did not update the test but I think it should be equal to what you had but it moves all the metadata.json file reading/testing to the metadataFromVagrantBox function.

Adds architecture support to the vagrant post-processor. Can be provided
via configuration. If unset, it will automatically be defaulted to the
builder host's detected architecture.

File builder support was added to the vagrant post-processor to make
testing easier.

Architecture support added to the vagrant-cloud post-processor. Includes
updating to the `v2` API which includes architecture support. Two new
options are added:

* `architecture` - architecture of the guest
* `default_architecture` - backwards compatibility feature

The new options are used when creating a provider, and the architecture
value is used on the API path when preparing the upload.

Small adjustment in the vagrant-cloud post-processor test so the
artifact's `IdValue` matches the defined box's provider. This was simply
done to provide a bit more clarity on the mocked API paths.
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updates look great :shipit:

@nywilken nywilken added the version/bump minor A PR that changes behavior or contains breaking changes template configuration options. label Oct 6, 2023
@nywilken nywilken merged commit 5b453a1 into hashicorp:main Oct 6, 2023
@chrisroberts chrisroberts deleted the architecture-support branch October 7, 2023 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement version/bump minor A PR that changes behavior or contains breaking changes template configuration options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants