From bde4b9b427dd9b0b21ebfa5fab68c730869749a3 Mon Sep 17 00:00:00 2001 From: Jay Soffian Date: Tue, 11 Jun 2024 04:07:56 -0400 Subject: [PATCH] Add support for arm64_mac architecture --- .web-docs/components/builder/chroot/README.md | 2 +- .web-docs/components/builder/ebssurrogate/README.md | 2 +- builder/chroot/builder.go | 6 +++--- builder/ebssurrogate/builder.go | 6 +++--- docs-partials/builder/chroot/Config-not-required.mdx | 2 +- docs-partials/builder/ebssurrogate/Config-not-required.mdx | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.web-docs/components/builder/chroot/README.md b/.web-docs/components/builder/chroot/README.md index a4f4a1103..ed5684657 100644 --- a/.web-docs/components/builder/chroot/README.md +++ b/.web-docs/components/builder/chroot/README.md @@ -214,7 +214,7 @@ necessary for this build to succeed and can be found further down the page. prefix `kms_key_id` with `alias/`. - `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options - are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". + are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". - `boot_mode` (string) - The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on [boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for diff --git a/.web-docs/components/builder/ebssurrogate/README.md b/.web-docs/components/builder/ebssurrogate/README.md index 6a878022e..afb83d396 100644 --- a/.web-docs/components/builder/ebssurrogate/README.md +++ b/.web-docs/components/builder/ebssurrogate/README.md @@ -72,7 +72,7 @@ necessary for this build to succeed and can be found further down the page. will allow you to create those programatically. - `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options - are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". + are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". - `boot_mode` (string) - The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on [boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for diff --git a/builder/chroot/builder.go b/builder/chroot/builder.go index 5113afab4..edf479837 100644 --- a/builder/chroot/builder.go +++ b/builder/chroot/builder.go @@ -195,7 +195,7 @@ type Config struct { // prefix `kms_key_id` with `alias/`. RootVolumeKmsKeyId string `mapstructure:"root_volume_kms_key_id" required:"false"` // what architecture to use when registering the final AMI; valid options - // are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". + // are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". Architecture string `mapstructure:"ami_architecture" required:"false"` // The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on // [boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for @@ -370,14 +370,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { } valid := false - for _, validArch := range []string{"arm64", "i386", "x86_64", "x86_64_mac"} { + for _, validArch := range []string{"arm64", "arm64_mac", "i386", "x86_64", "x86_64_mac"} { if validArch == b.config.Architecture { valid = true break } } if !valid { - errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "i386", "x86_64", or "x86_64_mac"`)) + errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac"`)) } if b.config.TpmSupport != "" && b.config.TpmSupport != ec2.TpmSupportValuesV20 { diff --git a/builder/ebssurrogate/builder.go b/builder/ebssurrogate/builder.go index 123b451fb..7587026e3 100644 --- a/builder/ebssurrogate/builder.go +++ b/builder/ebssurrogate/builder.go @@ -71,7 +71,7 @@ type Config struct { // will allow you to create those programatically. VolumeRunTag config.NameValues `mapstructure:"run_volume_tag" required:"false"` // what architecture to use when registering the final AMI; valid options - // are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". + // are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". Architecture string `mapstructure:"ami_architecture" required:"false"` // The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on // [boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for @@ -186,14 +186,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) { b.config.Architecture = "x86_64" } valid := false - for _, validArch := range []string{"arm64", "i386", "x86_64", "x86_64_mac"} { + for _, validArch := range []string{"arm64", "arm64_mac", "i386", "x86_64", "x86_64_mac"} { if validArch == b.config.Architecture { valid = true break } } if !valid { - errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "i386", "x86_64", or "x86_64_mac"`)) + errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac"`)) } if b.config.TpmSupport != "" && b.config.TpmSupport != ec2.TpmSupportValuesV20 { diff --git a/docs-partials/builder/chroot/Config-not-required.mdx b/docs-partials/builder/chroot/Config-not-required.mdx index 195e62800..1e2d9b55c 100644 --- a/docs-partials/builder/chroot/Config-not-required.mdx +++ b/docs-partials/builder/chroot/Config-not-required.mdx @@ -152,7 +152,7 @@ prefix `kms_key_id` with `alias/`. - `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options - are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". + are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". - `boot_mode` (string) - The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on [boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for diff --git a/docs-partials/builder/ebssurrogate/Config-not-required.mdx b/docs-partials/builder/ebssurrogate/Config-not-required.mdx index 77358a1d6..61bb1c6ad 100644 --- a/docs-partials/builder/ebssurrogate/Config-not-required.mdx +++ b/docs-partials/builder/ebssurrogate/Config-not-required.mdx @@ -28,7 +28,7 @@ will allow you to create those programatically. - `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options - are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". + are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64". - `boot_mode` (string) - The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on [boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for