From a112000ee359ea2f562403fbd7d642c76ca94a96 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Thu, 9 Nov 2023 09:10:34 +0000 Subject: [PATCH] (CAT-1545) - Add machine type to matrix This commit adds a machine_type field to each object in the matrix platforms. This means that for arm-based architectures, we can return the t2a-standard-2 machine which supports arm. If not arm based, then resort back to default. --- exe/matrix_from_metadata_v2 | 4 +++- spec/exe/matrix_from_metadata_v2_spec.rb | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/exe/matrix_from_metadata_v2 b/exe/matrix_from_metadata_v2 index 44d8b552..a4bb1a90 100755 --- a/exe/matrix_from_metadata_v2 +++ b/exe/matrix_from_metadata_v2 @@ -157,7 +157,9 @@ else matrix[:platforms] << { label: image_key, provider: 'provision_service', - image: IMAGE_TABLE[image_key] + image: IMAGE_TABLE[image_key], + # if the image is to be an ARM based instance, use t2a-standard-2 machine type + machine_type: image_key.include?('arm') ? 't2a-standard-2' : 'n1-standard-2' } elsif DOCKER_PLATFORMS.key?(image_key) && !exclude_list.include?(image_key.downcase) matrix[:platforms] << { diff --git a/spec/exe/matrix_from_metadata_v2_spec.rb b/spec/exe/matrix_from_metadata_v2_spec.rb index 849355d5..0c24956f 100644 --- a/spec/exe/matrix_from_metadata_v2_spec.rb +++ b/spec/exe/matrix_from_metadata_v2_spec.rb @@ -23,8 +23,8 @@ 'matrix={', '"platforms":[', '{"label":"CentOS-6","provider":"docker","image":"litmusimage/centos:6"},', - '{"label":"RedHat-8","provider":"provision_service","image":"rhel-8"},', - '{"label":"RedHat-9-arm","provider":"provision_service","image":"rhel-9-arm64"},', + '{"label":"RedHat-8","provider":"provision_service","image":"rhel-8","machine_type":"n1-standard-2"},', + '{"label":"RedHat-9-arm","provider":"provision_service","image":"rhel-9-arm64","machine_type":"t2a-standard-2"},', '{"label":"Ubuntu-18.04","provider":"docker","image":"litmusimage/ubuntu:18.04"}', '],', '"collection":[', @@ -61,8 +61,8 @@ 'matrix={', '"platforms":[', '{"label":"CentOS-6","provider":"docker","image":"litmusimage/centos:6"},', - '{"label":"RedHat-8","provider":"provision_service","image":"rhel-8"},', - '{"label":"RedHat-9-arm","provider":"provision_service","image":"rhel-9-arm64"}', + '{"label":"RedHat-8","provider":"provision_service","image":"rhel-8","machine_type":"n1-standard-2"},', + '{"label":"RedHat-9-arm","provider":"provision_service","image":"rhel-9-arm64","machine_type":"t2a-standard-2"}', '],', '"collection":[', '"puppet7-nightly","puppet8-nightly"', @@ -99,7 +99,7 @@ 'matrix={', '"platforms":[', '{"label":"CentOS-6","provider":"docker","image":"litmusimage/centos:6"},', - '{"label":"RedHat-9-arm","provider":"provision_service","image":"rhel-9-arm64"}', + '{"label":"RedHat-9-arm","provider":"provision_service","image":"rhel-9-arm64","machine_type":"t2a-standard-2"}', '],', '"collection":[', '"puppet7-nightly","puppet8-nightly"',