diff --git a/Makefile b/Makefile index 6dd1b60d..6af8ca16 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ GOPROXY ?= "https://proxy.golang.org,direct" MAKEFILE_PATH = $(dir $(realpath -s $(firstword $(MAKEFILE_LIST)))) BUILD_DIR_PATH = ${MAKEFILE_PATH}/build SUPPORTED_PLATFORMS ?= "windows/amd64,darwin/amd64,darwin/arm64,linux/amd64,linux/arm64,linux/arm" -SELECTOR_PKG_VERSION_VAR=github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector.versionID +SELECTOR_PKG_VERSION_VAR=github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector.versionID LATEST_RELEASE_TAG=$(shell git describe --tags --abbrev=0) PREVIOUS_RELEASE_TAG=$(shell git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) @@ -85,7 +85,7 @@ sync-readme-to-dockerhub: ${MAKEFILE_PATH}/scripts/sync-readme-to-dockerhub unit-test: - go test -bench=. ${MAKEFILE_PATH}/... -v -coverprofile=coverage.out -covermode=atomic -outputdir=${BUILD_DIR_PATH} + go test -bench=. ./... -v -coverprofile=coverage.out -covermode=atomic -outputdir=${BUILD_DIR_PATH} ## requires aws credentials e2e-test: build diff --git a/README.md b/README.md index 763a2030..3f7db4df 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ Instance Selector can also be consumed as a go library for direct integration in - Filter AWS Instance Types using declarative resource criteria like vcpus, memory, network performance, and much more! - Aggregate filters allow for more opinionated instance selections like `--base-instance-type` and `--flexible` -- Consumable as a go library +- Consumable as a go library or CLI +- Interactive TUI w/ `--output interactive` ## Installation and Configuration @@ -86,6 +87,11 @@ c5ad.large c5d.large c6a.large c6i.large +c6id.large +c6in.large +c7a.large +c7i-flex.large +c7i.large t2.medium t3.medium t3a.medium @@ -97,56 +103,66 @@ $ ec2-instance-selector --network-performance 100 --usage-class spot -r us-east- c5n.18xlarge c5n.metal c6gn.16xlarge +c6in.16xlarge +c7gn.8xlarge dl1.24xlarge g4dn.metal g5.48xlarge +g6.48xlarge +g6e.12xlarge i3en.24xlarge i3en.metal im4gn.16xlarge inf1.24xlarge +inf2.48xlarge m5dn.24xlarge m5dn.metal m5n.24xlarge m5n.metal m5zn.12xlarge -m5zn.metal -p3dn.24xlarge -p4d.24xlarge -r5dn.24xlarge -r5dn.metal +NOTE: 19 entries were truncated, increase --max-results to see more ``` **Short Table Output** ``` $ ec2-instance-selector --memory 4 --vcpus 2 --cpu-architecture x86_64 -r us-east-1 -o table -Instance Type VCPUs Mem (GiB) -------------- ----- --------- -c5.large 2 4 -c5a.large 2 4 -c5ad.large 2 4 -c5d.large 2 4 -c6a.large 2 4 -c6i.large 2 4 -t2.medium 2 4 -t3.medium 2 4 -t3a.medium 2 4 +Instance Type VCPUs Mem (GiB) +------------- ----- --------- +c5.large 2 4 +c5a.large 2 4 +c5ad.large 2 4 +c5d.large 2 4 +c6a.large 2 4 +c6i.large 2 4 +c6id.large 2 4 +c6in.large 2 4 +c7a.large 2 4 +c7i-flex.large 2 4 +c7i.large 2 4 +t2.medium 2 4 +t3.medium 2 4 +t3a.medium 2 4 ``` **Wide Table Output** ``` $ ec2-instance-selector --memory 4 --vcpus 2 --cpu-architecture x86_64 -r us-east-1 -o table-wide -Instance Type VCPUs Mem (GiB) Hypervisor Current Gen Hibernation Support CPU Arch Network Performance ENIs GPUs GPU Mem (GiB) GPU Info On-Demand Price/Hr Spot Price/Hr (30d avg) -------------- ----- --------- ---------- ----------- ------------------- -------- ------------------- ---- ---- ------------- -------- ------------------ ----------------------- -c5.large 2 4 nitro true true x86_64 Up to 10 Gigabit 3 0 0 none -Not Fetched- $0.03932 -c5a.large 2 4 nitro true false x86_64 Up to 10 Gigabit 3 0 0 none -Not Fetched- $0.03822 -c5ad.large 2 4 nitro true false x86_64 Up to 10 Gigabit 3 0 0 none -Not Fetched- $0.03449 -c5d.large 2 4 nitro true true x86_64 Up to 10 Gigabit 3 0 0 none $0.096 $0.03983 -c6a.large 2 4 nitro true false x86_64 Up to 12.5 Gigabit 3 0 0 none $0.0765 $0.034 -c6i.large 2 4 nitro true false x86_64 Up to 12.5 Gigabit 3 0 0 none $0.085 $0.03605 -c6id.large 2 4 nitro true false x86_64 Up to 12.5 Gigabit 3 0 0 none -Not Fetched- $0.034 -t2.medium 2 4 xen true true i386, x86_64 Low to Moderate 3 0 0 none $0.0464 $0.0139 -t3.medium 2 4 nitro true true x86_64 Up to 5 Gigabit 3 0 0 none $0.0416 $0.0125 -t3a.medium 2 4 nitro true true x86_64 Up to 5 Gigabit 3 0 0 none -Not Fetched- $0.01246 +Instance Type VCPUs Mem (GiB) Hypervisor Current Gen Hibernation Support CPU Arch Network Performance ENIs GPUs GPU Mem (GiB) GPU Info On-Demand Price/Hr Spot Price/Hr +------------- ----- --------- ---------- ----------- ------------------- -------- ------------------- ---- ---- ------------- -------- ------------------ ------------- +c5.large 2 4 nitro true true x86_64 Up to 10 Gigabit 3 0 0 none $0.085 $0.0405 +c5a.large 2 4 nitro true false x86_64 Up to 10 Gigabit 3 0 0 none $0.077 $0.0308 +c5ad.large 2 4 nitro true false x86_64 Up to 10 Gigabit 3 0 0 none $0.086 $0.0415 +c5d.large 2 4 nitro true true x86_64 Up to 10 Gigabit 3 0 0 none $0.096 $0.0281 +c6a.large 2 4 nitro true false x86_64 Up to 12.5 Gigabit 3 0 0 none $0.0765 $0.0285 +c6i.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.085 $0.0292 +c6id.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.1008 $0.0391 +c6in.large 2 4 nitro true false x86_64 Up to 25 Gigabit 3 0 0 none $0.1134 $0.0403 +c7a.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.10264 $0.0457 +c7i-flex.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.08479 $0.022 +c7i.large 2 4 nitro true true x86_64 Up to 12.5 Gigabit 3 0 0 none $0.08925 $0.0359 +t2.medium 2 4 xen true true i386, x86_64 Low to Moderate 3 0 0 none $0.0464 $0.0156 +t3.medium 2 4 nitro true true x86_64 Up to 5 Gigabit 3 0 0 none $0.0416 $0.015 +t3a.medium 2 4 nitro true true x86_64 Up to 5 Gigabit 3 0 0 none $0.0376 $0.0106 ``` **Interactive Output** @@ -158,44 +174,99 @@ https://user-images.githubusercontent.com/68402662/184218343-6b236d4a-3fe6-42ae- **Sort by memory in ascending order using shorthand** ``` $ ec2-instance-selector -r us-east-1 -o table-wide --max-results 10 --sort-by memory --sort-direction asc -Instance Type VCPUs Mem (GiB) Hypervisor Current Gen Hibernation Support CPU Arch Network Performance ENIs GPUs GPU Mem (GiB) GPU Info On-Demand Price/Hr Spot Price/Hr (30d avg) -------------- ----- --------- ---------- ----------- ------------------- -------- ------------------- ---- ---- ------------- -------- ------------------ ----------------------- -t2.nano 1 0.5 xen true true i386, x86_64 Low to Moderate 2 0 0 none $0.0058 -Not Fetched- -t4g.nano 2 0.5 nitro true false arm64 Up to 5 Gigabit 2 0 0 none $0.0042 $0.0013 -t3a.nano 2 0.5 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none -Not Fetched- $0.00328 -t3.nano 2 0.5 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0052 $0.0016 -t1.micro 1 0.6123 xen false false i386, x86_64 Very Low 2 0 0 none -Not Fetched- $0.00205 -t3a.micro 2 1 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none -Not Fetched- $0.00284 -t3.micro 2 1 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0104 $0.0031 -t2.micro 1 1 xen true true i386, x86_64 Low to Moderate 2 0 0 none -Not Fetched- $0.0035 -t4g.micro 2 1 nitro true false arm64 Up to 5 Gigabit 2 0 0 none -Not Fetched- $0.0025 -m1.small 1 1.69922 xen false false i386, x86_64 Low 2 0 0 none -Not Fetched- $0.01876 -NOTE: 547 entries were truncated, increase --max-results to see more +Instance Type VCPUs Mem (GiB) Hypervisor Current Gen Hibernation Support CPU Arch Network Performance ENIs GPUs GPU Mem (GiB) GPU Info On-Demand Price/Hr Spot Price/Hr +------------- ----- --------- ---------- ----------- ------------------- -------- ------------------- ---- ---- ------------- -------- ------------------ ------------- +t3a.nano 2 0.5 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0047 $0.0018 +t2.nano 1 0.5 xen true true i386, x86_64 Low to Moderate 2 0 0 none $0.0058 -Not Fetched- +t4g.nano 2 0.5 nitro true true arm64 Up to 5 Gigabit 2 0 0 none $0.0042 $0.0018 +t3.nano 2 0.5 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0052 $0.0006 +t1.micro 1 0.6123 xen false false i386, x86_64 Very Low 2 0 0 none $0.02 $0.0021 +t3.micro 2 1 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0104 $0.0029 +t2.micro 1 1 xen true true i386, x86_64 Low to Moderate 2 0 0 none $0.0116 $0.0016 +t4g.micro 2 1 nitro true true arm64 Up to 5 Gigabit 2 0 0 none $0.0084 $0.0024 +t3a.micro 2 1 nitro true true x86_64 Up to 5 Gigabit 2 0 0 none $0.0094 $0.0031 +m1.small 1 1.69922 xen false false i386, x86_64 Low 2 0 0 none $0.044 $0.0048 +NOTE: 832 entries were truncated, increase --max-results to see more ``` Available shorthand flags: vcpus, memory, gpu-memory-total, network-interfaces, spot-price, on-demand-price, instance-storage, ebs-optimized-baseline-bandwidth, ebs-optimized-baseline-throughput, ebs-optimized-baseline-iops, gpus, inference-accelerators **Sort by memory in descending order using JSON path** ``` $ ec2-instance-selector -r us-east-1 -o table-wide --max-results 10 --sort-by .MemoryInfo.SizeInMiB --sort-direction desc -Instance Type VCPUs Mem (GiB) Hypervisor Current Gen Hibernation Support CPU Arch Network Performance ENIs GPUs GPU Mem (GiB) GPU Info On-Demand Price/Hr Spot Price/Hr (30d avg) -------------- ----- --------- ---------- ----------- ------------------- -------- ------------------- ---- ---- ------------- -------- ------------------ ----------------------- -u-12tb1.112xlarge 448 12,288 nitro true false x86_64 100 Gigabit 15 0 0 none $109.2 -Not Fetched- -u-9tb1.112xlarge 448 9,216 nitro true false x86_64 100 Gigabit 15 0 0 none -Not Fetched- -Not Fetched- -u-6tb1.112xlarge 448 6,144 nitro true false x86_64 100 Gigabit 15 0 0 none $54.6 -Not Fetched- -u-6tb1.56xlarge 224 6,144 nitro true false x86_64 100 Gigabit 15 0 0 none $46.40391 -Not Fetched- -x2iedn.metal 128 4,096 none true false x86_64 100 Gigabit 15 0 0 none $26.676 $20.92296 -x2iedn.32xlarge 128 4,096 nitro true false x86_64 100 Gigabit 15 0 0 none $26.676 $8.70294 -x1e.32xlarge 128 3,904 xen true false x86_64 25 Gigabit 8 0 0 none $26.688 $8.0064 -x2iedn.24xlarge 96 3,072 nitro true false x86_64 75 Gigabit 15 0 0 none $20.007 $6.0021 -u-3tb1.56xlarge 224 3,072 nitro true false x86_64 50 Gigabit 8 0 0 none $27.3 -Not Fetched- -x2idn.metal 128 2,048 none true false x86_64 100 Gigabit 15 0 0 none $13.338 $7.46603 -NOTE: 547 entries were truncated, increase --max-results to see more +Instance Type VCPUs Mem (GiB) Hypervisor Current Gen Hibernation Support CPU Arch Network Performance ENIs GPUs GPU Mem (GiB) GPU Info On-Demand Price/Hr Spot Price/Hr +------------- ----- --------- ---------- ----------- ------------------- -------- ------------------- ---- ---- ------------- -------- ------------------ ------------- +u7in-32tb.224xlarge 896 32,768 nitro true false x86_64 200 Gigabit 16 0 0 none $407.68 -Not Fetched- +u7in-24tb.224xlarge 896 24,576 nitro true false x86_64 200 Gigabit 16 0 0 none $305.76 -Not Fetched- +u-24tb1.112xlarge 448 24,576 nitro true false x86_64 100 Gigabit 15 0 0 none $218.4 -Not Fetched- +u-18tb1.112xlarge 448 18,432 nitro true false x86_64 100 Gigabit 15 0 0 none $163.8 -Not Fetched- +u7in-16tb.224xlarge 896 16,384 nitro true false x86_64 200 Gigabit 16 0 0 none $203.84 -Not Fetched- +u7i-12tb.224xlarge 896 12,288 nitro true false x86_64 100 Gigabit 15 0 0 none $152.88 -Not Fetched- +u-12tb1.112xlarge 448 12,288 nitro true false x86_64 100 Gigabit 15 0 0 none $109.2 -Not Fetched- +u-9tb1.112xlarge 448 9,216 nitro true false x86_64 100 Gigabit 15 0 0 none $81.9 -Not Fetched- +u-6tb1.56xlarge 224 6,144 nitro true false x86_64 100 Gigabit 15 0 0 none $46.40391 -Not Fetched- +u-6tb1.112xlarge 448 6,144 nitro true false x86_64 100 Gigabit 15 0 0 none $54.6 -Not Fetched- +NOTE: 832 entries were truncated, increase --max-results to see more ``` JSON path must point to a field in the [instancetype.Details struct](https://github.com/aws/amazon-ec2-instance-selector/blob/5bffbf2750ee09f5f1308bdc8d4b635a2c6e2721/pkg/instancetypes/instancetypes.go#L37). **Example output of instance type object using Verbose output** ``` $ ec2-instance-selector --max-results 1 -v +NOTE: + +"Filters": { + "AllowList": null, + "DenyList": null, + "AvailabilityZones": [], + "BareMetal": null, + "Burstable": null, + "AutoRecovery": null, + "FreeTier": null, + "CPUArchitecture": null, + "CPUManufacturer": null, + "CurrentGeneration": null, + "EnaSupport": null, + "EfaSupport": null, + "Fpga": null, + "GpusRange": null, + "GpuMemoryRange": null, + "GPUManufacturer": null, + "GPUModel": null, + "InferenceAcceleratorsRange": null, + "InferenceAcceleratorManufacturer": null, + "InferenceAcceleratorModel": null, + "HibernationSupported": null, + "Hypervisor": null, + "MaxResults": 1, + "MemoryRange": null, + "NetworkInterfaces": null, + "NetworkPerformance": null, + "NetworkEncryption": null, + "IPv6": null, + "PlacementGroupStrategy": null, + "Region": "us-east-1", + "RootDeviceType": null, + "UsageClass": null, + "VCpusRange": null, + "VCpusToMemoryRatio": null, + "InstanceTypeBase": null, + "Flexible": null, + "Service": null, + "InstanceTypes": null, + "VirtualizationType": null, + "PricePerHour": null, + "InstanceStorageRange": null, + "DiskType": null, + "NVME": null, + "EBSOptimized": null, + "DiskEncryption": null, + "EBSOptimizedBaselineBandwidth": null, + "EBSOptimizedBaselineThroughput": null, + "EBSOptimizedBaselineIOPS": null, + "DedicatedHosts": null, + "Generation": null +} +NOTE: There were no transformations on the filters to display [ { "AutoRecoverySupported": true, @@ -225,6 +296,7 @@ $ ec2-instance-selector --max-results 1 -v "InstanceStorageInfo": null, "InstanceStorageSupported": false, "InstanceType": "a1.2xlarge", + "MediaAcceleratorInfo": null, "MemoryInfo": { "SizeInMiB": 16384 }, @@ -232,6 +304,7 @@ $ ec2-instance-selector --max-results 1 -v "DefaultNetworkCardIndex": 0, "EfaInfo": null, "EfaSupported": false, + "EnaSrdSupported": false, "EnaSupport": "required", "EncryptionInTransitSupported": false, "Ipv4AddressesPerInterface": 15, @@ -241,13 +314,20 @@ $ ec2-instance-selector --max-results 1 -v "MaximumNetworkInterfaces": 4, "NetworkCards": [ { + "BaselineBandwidthInGbps": 2.5, "MaximumNetworkInterfaces": 4, "NetworkCardIndex": 0, - "NetworkPerformance": "Up to 10 Gigabit" + "NetworkPerformance": "Up to 10 Gigabit", + "PeakBandwidthInGbps": 10 } ], "NetworkPerformance": "Up to 10 Gigabit" }, + "NeuronInfo": null, + "NitroEnclavesSupport": "unsupported", + "NitroTpmInfo": null, + "NitroTpmSupport": "unsupported", + "PhcSupport": "unsupported", "PlacementGroupInfo": { "SupportedStrategies": [ "cluster", @@ -256,9 +336,11 @@ $ ec2-instance-selector --max-results 1 -v ] }, "ProcessorInfo": { + "Manufacturer": "AWS", "SupportedArchitectures": [ "arm64" ], + "SupportedFeatures": null, "SustainedClockSpeedInGhz": 2.3 }, "SupportedBootModes": [ @@ -281,11 +363,11 @@ $ ec2-instance-selector --max-results 1 -v "ValidCores": null, "ValidThreadsPerCore": null }, - "OndemandPricePerHour": 0.204, - "SpotPrice": 0.03939999999999999 + "OndemandPricePerHour": null, + "SpotPrice": null } ] -NOTE: 497 entries were truncated, increase --max-results to see more +NOTE: 841 entries were truncated, increase --max-results to see more ``` NOTE: Use this JSON format as reference when finding JSON paths for sorting @@ -414,8 +496,8 @@ import ( "context" "fmt" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" "github.com/aws/aws-sdk-go-v2/config" ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" ) @@ -480,7 +562,7 @@ func main() { $ git clone https://github.com/aws/amazon-ec2-instance-selector.git $ cd amazon-ec2-instance-selector/ $ go run cmd/examples/example1.go -[c4.large c5.large c5a.large c5ad.large c5d.large c6i.large t2.medium t3.medium t3.small t3a.medium t3a.small] +[c4.large c5.large c5a.large c5ad.large c5d.large c6a.large c6i.large c6id.large c6in.large c7a.large c7i-flex.large c7i.large t2.medium t3.medium t3.small t3a.medium t3a.small] ``` ## Building diff --git a/cmd/examples/example1.go b/cmd/examples/example1.go index 48d44666..b4760361 100644 --- a/cmd/examples/example1.go +++ b/cmd/examples/example1.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" "github.com/aws/aws-sdk-go-v2/config" ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" ) diff --git a/cmd/main.go b/cmd/main.go index a0d2f6fb..a7cacce3 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -24,12 +24,12 @@ import ( "syscall" "time" - commandline "github.com/aws/amazon-ec2-instance-selector/v2/pkg/cli" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/env" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector/outputs" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/sorter" + commandline "github.com/aws/amazon-ec2-instance-selector/v3/pkg/cli" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/env" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector/outputs" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/sorter" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" diff --git a/go.mod b/go.mod index f730ad02..e3163bbb 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/aws/amazon-ec2-instance-selector/v2 +module github.com/aws/amazon-ec2-instance-selector/v3 go 1.23 diff --git a/pkg/bytequantity/bytequantity_test.go b/pkg/bytequantity/bytequantity_test.go index 7a110873..2cae9b7e 100644 --- a/pkg/bytequantity/bytequantity_test.go +++ b/pkg/bytequantity/bytequantity_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" ) func TestParseToByteQuantity(t *testing.T) { diff --git a/pkg/cli/cli.go b/pkg/cli/cli.go index 77a4d0b8..5b244dae 100644 --- a/pkg/cli/cli.go +++ b/pkg/cli/cli.go @@ -21,8 +21,8 @@ import ( "reflect" "strings" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" "github.com/spf13/cobra" "github.com/spf13/pflag" ) diff --git a/pkg/cli/cli_internal_test.go b/pkg/cli/cli_internal_test.go index 019100bf..34ab1916 100644 --- a/pkg/cli/cli_internal_test.go +++ b/pkg/cli/cli_internal_test.go @@ -17,7 +17,7 @@ import ( "os" "testing" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" "github.com/spf13/pflag" ) diff --git a/pkg/cli/cli_test.go b/pkg/cli/cli_test.go index a3ed2535..8e7155c1 100644 --- a/pkg/cli/cli_test.go +++ b/pkg/cli/cli_test.go @@ -20,10 +20,10 @@ import ( "reflect" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/cli" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/cli" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" "github.com/spf13/cobra" ) diff --git a/pkg/cli/flags.go b/pkg/cli/flags.go index 5b50221a..1e235a17 100644 --- a/pkg/cli/flags.go +++ b/pkg/cli/flags.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" "github.com/mitchellh/go-homedir" "github.com/spf13/pflag" ) diff --git a/pkg/cli/flags_test.go b/pkg/cli/flags_test.go index ab737f93..6f15aa0b 100644 --- a/pkg/cli/flags_test.go +++ b/pkg/cli/flags_test.go @@ -17,8 +17,8 @@ import ( "fmt" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" ) // Tests diff --git a/pkg/cli/types.go b/pkg/cli/types.go index 97a4f22f..ea23a992 100644 --- a/pkg/cli/types.go +++ b/pkg/cli/types.go @@ -18,8 +18,8 @@ import ( "log" "regexp" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" "github.com/spf13/cobra" "github.com/spf13/pflag" ) diff --git a/pkg/cli/types_test.go b/pkg/cli/types_test.go index 20ebaef5..2763181f 100644 --- a/pkg/cli/types_test.go +++ b/pkg/cli/types_test.go @@ -18,9 +18,9 @@ import ( "regexp" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" ) // Tests diff --git a/pkg/ec2pricing/ec2pricing_test.go b/pkg/ec2pricing/ec2pricing_test.go index cb695ab5..72d2c64e 100644 --- a/pkg/ec2pricing/ec2pricing_test.go +++ b/pkg/ec2pricing/ec2pricing_test.go @@ -22,8 +22,8 @@ import ( ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/ec2pricing" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/ec2pricing" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" "github.com/aws/aws-sdk-go-v2/service/ec2" "github.com/aws/aws-sdk-go-v2/service/pricing" ) diff --git a/pkg/selector/aggregates.go b/pkg/selector/aggregates.go index b5f3e613..16e8a49f 100644 --- a/pkg/selector/aggregates.go +++ b/pkg/selector/aggregates.go @@ -3,10 +3,11 @@ package selector import ( "context" "fmt" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" + "regexp" + + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" "github.com/aws/aws-sdk-go-v2/service/ec2" ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" - "regexp" ) const ( diff --git a/pkg/selector/aggregates_test.go b/pkg/selector/aggregates_test.go index 3211a031..84d5549f 100644 --- a/pkg/selector/aggregates_test.go +++ b/pkg/selector/aggregates_test.go @@ -17,8 +17,8 @@ import ( "context" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" ) // Tests diff --git a/pkg/selector/comparators_internal_test.go b/pkg/selector/comparators_internal_test.go index 80016313..40beb1a6 100644 --- a/pkg/selector/comparators_internal_test.go +++ b/pkg/selector/comparators_internal_test.go @@ -17,7 +17,7 @@ import ( "math" "testing" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" "github.com/aws/aws-sdk-go-v2/aws" ) diff --git a/pkg/selector/emr_test.go b/pkg/selector/emr_test.go index 37f278e9..504951fa 100644 --- a/pkg/selector/emr_test.go +++ b/pkg/selector/emr_test.go @@ -16,8 +16,8 @@ package selector_test import ( "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" ) // Tests diff --git a/pkg/selector/outputs/bubbletea.go b/pkg/selector/outputs/bubbletea.go index 74076874..e1e82104 100644 --- a/pkg/selector/outputs/bubbletea.go +++ b/pkg/selector/outputs/bubbletea.go @@ -14,8 +14,8 @@ package outputs import ( - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/sorter" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/sorter" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" "github.com/muesli/termenv" diff --git a/pkg/selector/outputs/bubbletea_internal_test.go b/pkg/selector/outputs/bubbletea_internal_test.go index 8decdb40..e2f9f82d 100644 --- a/pkg/selector/outputs/bubbletea_internal_test.go +++ b/pkg/selector/outputs/bubbletea_internal_test.go @@ -20,8 +20,8 @@ import ( "strings" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" "github.com/evertras/bubble-table/table" ) diff --git a/pkg/selector/outputs/outputs.go b/pkg/selector/outputs/outputs.go index dd16ec7a..4fe1da4c 100644 --- a/pkg/selector/outputs/outputs.go +++ b/pkg/selector/outputs/outputs.go @@ -24,7 +24,7 @@ import ( "strings" "text/tabwriter" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" ) const columnTag = "column" diff --git a/pkg/selector/outputs/outputs_test.go b/pkg/selector/outputs/outputs_test.go index a5fbe939..e7b2a001 100644 --- a/pkg/selector/outputs/outputs_test.go +++ b/pkg/selector/outputs/outputs_test.go @@ -20,9 +20,9 @@ import ( "strings" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector/outputs" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector/outputs" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" "github.com/aws/aws-sdk-go-v2/service/ec2" ) diff --git a/pkg/selector/outputs/sortingView.go b/pkg/selector/outputs/sortingView.go index 671b4d4e..f873a26c 100644 --- a/pkg/selector/outputs/sortingView.go +++ b/pkg/selector/outputs/sortingView.go @@ -18,8 +18,8 @@ import ( "io" "strings" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/sorter" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/sorter" "github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/list" "github.com/charmbracelet/bubbles/textinput" diff --git a/pkg/selector/outputs/tableView.go b/pkg/selector/outputs/tableView.go index 9dc05bce..4c337256 100644 --- a/pkg/selector/outputs/tableView.go +++ b/pkg/selector/outputs/tableView.go @@ -18,8 +18,8 @@ import ( "reflect" "strings" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/sorter" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/sorter" "github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/textinput" tea "github.com/charmbracelet/bubbletea" diff --git a/pkg/selector/outputs/verboseView.go b/pkg/selector/outputs/verboseView.go index 0852f73d..7201aaf4 100644 --- a/pkg/selector/outputs/verboseView.go +++ b/pkg/selector/outputs/verboseView.go @@ -18,7 +18,7 @@ import ( "math" "strings" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" "github.com/charmbracelet/bubbles/viewport" tea "github.com/charmbracelet/bubbletea" diff --git a/pkg/selector/selector.go b/pkg/selector/selector.go index 91ead91a..1032dfee 100644 --- a/pkg/selector/selector.go +++ b/pkg/selector/selector.go @@ -26,9 +26,9 @@ import ( "sync" "time" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/ec2pricing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector/outputs" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/ec2pricing" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector/outputs" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/service/ec2" diff --git a/pkg/selector/selector_test.go b/pkg/selector/selector_test.go index 22fca820..16fdd838 100644 --- a/pkg/selector/selector_test.go +++ b/pkg/selector/selector_test.go @@ -24,11 +24,11 @@ import ( "strconv" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/awsapi" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/awsapi" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/ec2" diff --git a/pkg/selector/services_test.go b/pkg/selector/services_test.go index de14f9ea..cd14af9e 100644 --- a/pkg/selector/services_test.go +++ b/pkg/selector/services_test.go @@ -16,8 +16,8 @@ package selector_test import ( "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" "github.com/aws/aws-sdk-go-v2/aws" ) diff --git a/pkg/selector/types.go b/pkg/selector/types.go index dd0900bd..23a017bd 100644 --- a/pkg/selector/types.go +++ b/pkg/selector/types.go @@ -18,12 +18,12 @@ import ( "log" "regexp" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/awsapi" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/awsapi" ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/bytequantity" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/ec2pricing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/bytequantity" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/ec2pricing" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" ) // InstanceTypesOutput can be implemented to provide custom output to instance type results diff --git a/pkg/selector/types_test.go b/pkg/selector/types_test.go index 3e115887..c61bff8c 100644 --- a/pkg/selector/types_test.go +++ b/pkg/selector/types_test.go @@ -18,8 +18,8 @@ import ( "strings" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types" ) diff --git a/pkg/sorter/sorter.go b/pkg/sorter/sorter.go index 311145b0..418fc195 100644 --- a/pkg/sorter/sorter.go +++ b/pkg/sorter/sorter.go @@ -20,7 +20,7 @@ import ( "sort" "strings" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" "github.com/oliveagle/jsonpath" ) diff --git a/pkg/sorter/sorter_test.go b/pkg/sorter/sorter_test.go index 8a59b0bf..25e8cfa8 100644 --- a/pkg/sorter/sorter_test.go +++ b/pkg/sorter/sorter_test.go @@ -20,10 +20,10 @@ import ( "strings" "testing" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/instancetypes" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/selector/outputs" - "github.com/aws/amazon-ec2-instance-selector/v2/pkg/sorter" - h "github.com/aws/amazon-ec2-instance-selector/v2/pkg/test" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/instancetypes" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/selector/outputs" + "github.com/aws/amazon-ec2-instance-selector/v3/pkg/sorter" + h "github.com/aws/amazon-ec2-instance-selector/v3/pkg/test" ) const ( diff --git a/test/readme-test/run-readme-codeblocks b/test/readme-test/run-readme-codeblocks index b58bb523..ebdf1181 100755 --- a/test/readme-test/run-readme-codeblocks +++ b/test/readme-test/run-readme-codeblocks @@ -22,8 +22,8 @@ interpreters=($(echo $rundoc_output | jq -r '.code_blocks[] | .interpreter')) ## Execute --help check which compares the help codeblock in the README to the actual output of the binary rd list-blocks -T "bash#help" /aeis/README.md | jq -r '.code_blocks[0] .code' > $BUILD_DIR/readme_help.out -docker run -t --rm codeblocks build/ec2-instance-selector --help > $BUILD_DIR/actual_help.out -diff --ignore-all-space --ignore-blank-lines "$BUILD_DIR/actual_help.out" "$BUILD_DIR/readme_help.out" +docker run -t --rm codeblocks build/ec2-instance-selector --help | perl -pe 's/\e\[?.*?[a-zA-Z]//g' > $BUILD_DIR/actual_help.out +diff --ignore-all-space --ignore-blank-lines --ignore-trailing-space "$BUILD_DIR/actual_help.out" "$BUILD_DIR/readme_help.out" echo "✅ README help section matches actual binary output!" ## Execute go codeblocks example tests which checks the go codeblocks in the readme with a source file path @@ -35,7 +35,7 @@ for i in "${!example_files[@]}"; do example_file="${example_files[$i]}" example_bin=$(echo $example_file | cut -d'.' -f1) mkdir -p $BUILD_DIR/examples - docker run -i -e GOOS=$OS -e GOARCH=amd64 -v $BUILD_DIR:/amazon-ec2-instance-selector/build --rm codeblocks go build -o build/examples/$example_bin $example_file + docker run -i -e GOOS=$OS -e GOARCH=amd64 -e CGO_ENABLED=0 -v $BUILD_DIR:/amazon-ec2-instance-selector/build --rm codeblocks go build -o build/examples/$example_bin $example_file $BUILD_DIR/examples/$example_bin echo "✅ $example_file Executed Successfully!" fi