mirror of
https://github.com/actions/runner-images.git
synced 2025-12-11 11:37:00 +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 {
|
locals {
|
||||||
image_properties_map = {
|
image_properties_map = {
|
||||||
"ubuntu22" = {
|
"ubuntu22" = {
|
||||||
publisher = "canonical"
|
source_image_marketplace_sku = "canonical:0001-com-ubuntu-server-jammy:22_04-lts"
|
||||||
offer = "0001-com-ubuntu-server-jammy"
|
os_disk_size_gb = 75
|
||||||
sku = "22_04-lts"
|
|
||||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, 75)
|
|
||||||
},
|
},
|
||||||
"ubuntu24" = {
|
"ubuntu24" = {
|
||||||
publisher = "canonical"
|
source_image_marketplace_sku = "canonical:ubuntu-24_04-lts:server-gen1"
|
||||||
offer = "ubuntu-24_04-lts"
|
os_disk_size_gb = 75
|
||||||
sku = "server-gen1"
|
|
||||||
os_disk_size_gb = coalesce(var.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
|
allowed_inbound_ip_addresses = var.allowed_inbound_ip_addresses
|
||||||
build_resource_group_name = var.build_resource_group_name
|
build_resource_group_name = var.build_resource_group_name
|
||||||
image_offer = local.image_properties.offer
|
image_publisher = split(":", local.source_image_marketplace_sku)[0]
|
||||||
image_publisher = local.image_properties.publisher
|
image_offer = split(":", local.source_image_marketplace_sku)[1]
|
||||||
image_sku = local.image_properties.sku
|
image_sku = split(":", local.source_image_marketplace_sku)[2]
|
||||||
image_version = var.source_image_version
|
image_version = var.source_image_version
|
||||||
location = var.location
|
location = var.location
|
||||||
managed_image_name = var.managed_image_name
|
managed_image_name = var.managed_image_name
|
||||||
managed_image_resource_group_name = var.managed_image_resource_group_name
|
managed_image_resource_group_name = var.managed_image_resource_group_name
|
||||||
managed_image_storage_account_type = var.managed_image_storage_account_type
|
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
|
os_type = var.image_os_type
|
||||||
private_virtual_network_with_public_ip = var.private_virtual_network_with_public_ip
|
private_virtual_network_with_public_ip = var.private_virtual_network_with_public_ip
|
||||||
ssh_clear_authorized_keys = var.ssh_clear_authorized_keys
|
ssh_clear_authorized_keys = var.ssh_clear_authorized_keys
|
||||||
|
|||||||
@@ -1,24 +1,19 @@
|
|||||||
locals {
|
locals {
|
||||||
image_properties_map = {
|
image_properties_map = {
|
||||||
"win19" = {
|
"win19" = {
|
||||||
publisher = "MicrosoftWindowsServer"
|
source_image_marketplace_sku = "MicrosoftWindowsServer:WindowsServer:2019-Datacenter"
|
||||||
offer = "WindowsServer"
|
os_disk_size_gb = 256
|
||||||
sku = "2019-Datacenter"
|
|
||||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, 256)
|
|
||||||
},
|
},
|
||||||
"win22" = {
|
"win22" = {
|
||||||
publisher = "MicrosoftWindowsServer"
|
source_image_marketplace_sku = "MicrosoftWindowsServer:WindowsServer:2022-Datacenter"
|
||||||
offer = "WindowsServer"
|
os_disk_size_gb = 256
|
||||||
sku = "2022-Datacenter"
|
|
||||||
os_disk_size_gb = coalesce(var.os_disk_size_gb, 256)
|
|
||||||
},
|
},
|
||||||
"win25" = {
|
"win25" = {
|
||||||
publisher = "MicrosoftWindowsServer"
|
source_image_marketplace_sku = "MicrosoftWindowsServer:WindowsServer:2025-Datacenter"
|
||||||
offer = "WindowsServer"
|
os_disk_size_gb = 150
|
||||||
sku = "2025-Datacenter"
|
|
||||||
os_disk_size_gb = coalesce(var.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_key_vault_secret_name = var.build_key_vault_secret_name
|
||||||
build_resource_group_name = var.build_resource_group_name
|
build_resource_group_name = var.build_resource_group_name
|
||||||
communicator = "winrm"
|
communicator = "winrm"
|
||||||
image_offer = local.image_properties.offer
|
image_publisher = split(":", local.source_image_marketplace_sku)[0]
|
||||||
image_publisher = local.image_properties.publisher
|
image_offer = split(":", local.source_image_marketplace_sku)[1]
|
||||||
image_sku = local.image_properties.sku
|
image_sku = split(":", local.source_image_marketplace_sku)[2]
|
||||||
image_version = var.source_image_version
|
image_version = var.source_image_version
|
||||||
location = var.location
|
location = var.location
|
||||||
managed_image_name = var.managed_image_name
|
managed_image_name = var.managed_image_name
|
||||||
managed_image_resource_group_name = var.managed_image_resource_group_name
|
managed_image_resource_group_name = var.managed_image_resource_group_name
|
||||||
managed_image_storage_account_type = var.managed_image_storage_account_type
|
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
|
os_type = var.image_os_type
|
||||||
private_virtual_network_with_public_ip = var.private_virtual_network_with_public_ip
|
private_virtual_network_with_public_ip = var.private_virtual_network_with_public_ip
|
||||||
temp_resource_group_name = var.temp_resource_group_name
|
temp_resource_group_name = var.temp_resource_group_name
|
||||||
|
|||||||
Reference in New Issue
Block a user