mirror of
https://github.com/actions/runner-images.git
synced 2025-12-10 19:16:48 +00:00
Refactor Source image SKUs in packer templates (#13364)
* [ubuntu] Refactor image properties mapping to use source_image_marketplace_sku * Refactor Ubuntu and Windows image properties to simplify disk size handling and update marketplace SKU mappings * Refactor disk size handling to use coalesce for improved flexibility
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
locals {
|
||||
image_properties_map = {
|
||||
"ubuntu22" = {
|
||||
publisher = "canonical"
|
||||
offer = "0001-com-ubuntu-server-jammy"
|
||||
sku = "22_04-lts"
|
||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, 75)
|
||||
source_image_marketplace_sku = "canonical:0001-com-ubuntu-server-jammy:22_04-lts"
|
||||
os_disk_size_gb = 75
|
||||
},
|
||||
"ubuntu24" = {
|
||||
publisher = "canonical"
|
||||
offer = "ubuntu-24_04-lts"
|
||||
sku = "server-gen1"
|
||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, 75)
|
||||
source_image_marketplace_sku = "canonical:ubuntu-24_04-lts:server-gen1"
|
||||
os_disk_size_gb = 75
|
||||
}
|
||||
}
|
||||
|
||||
image_properties = local.image_properties_map[var.image_os]
|
||||
source_image_marketplace_sku = local.image_properties_map[var.image_os].source_image_marketplace_sku
|
||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, local.image_properties_map[var.image_os].os_disk_size_gb)
|
||||
}
|
||||
|
||||
@@ -11,15 +11,15 @@ source "azure-arm" "image" {
|
||||
|
||||
allowed_inbound_ip_addresses = var.allowed_inbound_ip_addresses
|
||||
build_resource_group_name = var.build_resource_group_name
|
||||
image_offer = local.image_properties.offer
|
||||
image_publisher = local.image_properties.publisher
|
||||
image_sku = local.image_properties.sku
|
||||
image_publisher = split(":", local.source_image_marketplace_sku)[0]
|
||||
image_offer = split(":", local.source_image_marketplace_sku)[1]
|
||||
image_sku = split(":", local.source_image_marketplace_sku)[2]
|
||||
image_version = var.source_image_version
|
||||
location = var.location
|
||||
managed_image_name = var.managed_image_name
|
||||
managed_image_resource_group_name = var.managed_image_resource_group_name
|
||||
managed_image_storage_account_type = var.managed_image_storage_account_type
|
||||
os_disk_size_gb = local.image_properties.os_disk_size_gb
|
||||
os_disk_size_gb = local.os_disk_size_gb
|
||||
os_type = var.image_os_type
|
||||
private_virtual_network_with_public_ip = var.private_virtual_network_with_public_ip
|
||||
ssh_clear_authorized_keys = var.ssh_clear_authorized_keys
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
locals {
|
||||
image_properties_map = {
|
||||
"win19" = {
|
||||
publisher = "MicrosoftWindowsServer"
|
||||
offer = "WindowsServer"
|
||||
sku = "2019-Datacenter"
|
||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, 256)
|
||||
source_image_marketplace_sku = "MicrosoftWindowsServer:WindowsServer:2019-Datacenter"
|
||||
os_disk_size_gb = 256
|
||||
},
|
||||
"win22" = {
|
||||
publisher = "MicrosoftWindowsServer"
|
||||
offer = "WindowsServer"
|
||||
sku = "2022-Datacenter"
|
||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, 256)
|
||||
source_image_marketplace_sku = "MicrosoftWindowsServer:WindowsServer:2022-Datacenter"
|
||||
os_disk_size_gb = 256
|
||||
},
|
||||
"win25" = {
|
||||
publisher = "MicrosoftWindowsServer"
|
||||
offer = "WindowsServer"
|
||||
sku = "2025-Datacenter"
|
||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, 150)
|
||||
source_image_marketplace_sku = "MicrosoftWindowsServer:WindowsServer:2025-Datacenter"
|
||||
os_disk_size_gb = 150
|
||||
}
|
||||
}
|
||||
|
||||
image_properties = local.image_properties_map[var.image_os]
|
||||
source_image_marketplace_sku = local.image_properties_map[var.image_os].source_image_marketplace_sku
|
||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, local.image_properties_map[var.image_os].os_disk_size_gb)
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@ source "azure-arm" "image" {
|
||||
build_key_vault_secret_name = var.build_key_vault_secret_name
|
||||
build_resource_group_name = var.build_resource_group_name
|
||||
communicator = "winrm"
|
||||
image_offer = local.image_properties.offer
|
||||
image_publisher = local.image_properties.publisher
|
||||
image_sku = local.image_properties.sku
|
||||
image_publisher = split(":", local.source_image_marketplace_sku)[0]
|
||||
image_offer = split(":", local.source_image_marketplace_sku)[1]
|
||||
image_sku = split(":", local.source_image_marketplace_sku)[2]
|
||||
image_version = var.source_image_version
|
||||
location = var.location
|
||||
managed_image_name = var.managed_image_name
|
||||
managed_image_resource_group_name = var.managed_image_resource_group_name
|
||||
managed_image_storage_account_type = var.managed_image_storage_account_type
|
||||
os_disk_size_gb = local.image_properties.os_disk_size_gb
|
||||
os_disk_size_gb = local.os_disk_size_gb
|
||||
os_type = var.image_os_type
|
||||
private_virtual_network_with_public_ip = var.private_virtual_network_with_public_ip
|
||||
temp_resource_group_name = var.temp_resource_group_name
|
||||
|
||||
Reference in New Issue
Block a user