From c55eb79246f7c88e3552bdff0f53344fad5e1845 Mon Sep 17 00:00:00 2001 From: Viktor Ribchev Date: Wed, 13 Dec 2023 08:13:28 +0200 Subject: [PATCH] Removed features preventing build with Standard_B1ls VM Fixed create_image_definition.sh --- CHANGELOG.md | 5 +++++ create_image_definition.sh | 45 +++++++++++++++++++------------------- variables.pkr.hcl | 24 ++++++++++++++++---- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 283cada..7cd736b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to the Packer template for creating GraphDB Azure VM images will be documented in this file. +## 1.2.0 + +- Removed features preventing build with Standard_B1ls VM +- Fixed create_image_definition.sh + ## 1.1.0 - Installed Azure CLI diff --git a/create_image_definition.sh b/create_image_definition.sh index 8639efa..11cfd54 100644 --- a/create_image_definition.sh +++ b/create_image_definition.sh @@ -10,20 +10,22 @@ variables_file="variables.pkrvars.hcl" # Check if the file exists if [ -f "$variables_file" ]; then - # Use grep to extract the variable values - - image_definition_name=$(grep 'image_definition_name' "$variables_file" | cut -d '"' -f 2) - gdb_version=$(grep 'gdb_version' "$variables_file" | cut -d '"' -f 2) - gallery_resource_group=$(grep 'gallery_resource_group' "$variables_file" | cut -d '"' -f 2) - gallery_name=$(grep 'gallery_name' "$variables_file" | cut -d '"' -f 2) - - # Check if any of the required variables is empty - if [ -z "$image_definition_name" ] || [ -z "$gdb_version" ] || [ -z "$gallery_resource_group" ] || [ -z "$gallery_name" ]; then - echo "One or more required variables are not defined in $variables_file." - exit 1 - fi - # Construct the az sig image-definition create command - az_command="az sig image-definition create \ + # Use grep to extract the variable values + + image_definition_name=$(grep 'image_definition_name' "$variables_file" | cut -d '"' -f 2) + gdb_version=$(grep 'gdb_version' "$variables_file" | cut -d '"' -f 2) + gallery_resource_group=$(grep 'gallery_resource_group' "$variables_file" | cut -d '"' -f 2) + gallery_name=$(grep 'gallery_name' "$variables_file" | cut -d '"' -f 2) + + # Check if any of the required variables is empty + if [ -z "$image_definition_name" ] || [ -z "$gdb_version" ] || [ -z "$gallery_resource_group" ] || [ -z "$gallery_name" ]; then + echo "One or more required variables are not defined in $variables_file." + exit 1 + fi + # Construct the az sig image-definition create command + +# TODO extend command with --features 'IsAcceleratedNetworkSupported=true DiskControllerTypes=SCSI,NVMe' when we have quota for Standard_B2pts_v2 + az_command="az sig image-definition create \ -g $gallery_resource_group \ --gallery-name $gallery_name \ --gallery-image-definition "$image_definition_name" \ @@ -35,14 +37,13 @@ if [ -f "$variables_file" ]; then --minimum-cpu-core 4 \ --maximum-cpu-core 64 \ --minimum-memory 4 \ - --features 'IsAcceleratedNetworkSupported=true DiskControllerTypes=SCSI,NVMe' \ --maximum-memory 128 " - - echo "Extracted variables and constructed Azure CLI command:" - eval "$az_command" - az sig image-definition wait -i "$image_name_x86_64" -r "$gallery_name" -g "$gallery_resource_group" --created - packer build -var-file="variables.pkrvars.hcl" . + + echo "Extracted variables and constructed Azure CLI command:" + eval "$az_command" + az sig image-definition wait -i "$image_definition_name" -r "$gallery_name" -g "$gallery_resource_group" --created + packer build -var-file="variables.pkrvars.hcl" . else - echo "The variables file $variables_file does not exist." - exit 1 + echo "The variables file $variables_file does not exist." + exit 1 fi diff --git a/variables.pkr.hcl b/variables.pkr.hcl index 82640b4..60aba9c 100644 --- a/variables.pkr.hcl +++ b/variables.pkr.hcl @@ -1,68 +1,84 @@ variable subscription_id { type = string } + variable tenant_id { type = string } + variable client_id { type = string } + variable client_secret { type = string } + variable primary_location { type = string } + variable image_definition_name { type = string } -# Not supported yet -#variable image_name_arm64 { -# type = string -#} + variable gdb_version { type = string } + variable gallery_resource_group { type = string } + variable gallery_name { type = string } + variable my_ip_address { type = string } + variable replication_regions { type = list(string) } + variable os_type { type = string default = "Linux" } + variable image_offer { type = string default = "0001-com-ubuntu-server-jammy" } + variable image_publisher { type = string default = "canonical" } + variable image_sku { type = string default = "22_04-lts-gen2" } + variable vm_size { type = string default = "Standard_B1ls" + # TODO replace with B2pts_v2 when quota is available in order to build with IsAcceleratedNetworkSupported=true DiskControllerTypes=SCSI,NVMe features + # default = "Standard_B2pts_v2" } + variable image_replica_count { type = number default = 1 } + variable shared_gallery_image_version_exclude_from_latest { type = bool default = false } + variable os_disk_size_gb { type = number default = 30