diff --git a/Jenkinsfile_k8s b/Jenkinsfile_k8s index 625dd7ecd..e74f0f91a 100644 --- a/Jenkinsfile_k8s +++ b/Jenkinsfile_k8s @@ -87,7 +87,7 @@ pipeline { } axis { name 'agent_type' - values 'ubuntu-20.04', 'windows-2019' + values 'ubuntu-20.04', 'windows-2019', 'windows-2022' } axis { name 'compute_type' @@ -133,6 +133,16 @@ pipeline { values 'docker' } } + exclude { + axis { + name 'PKR_VAR_agent' + values 'windows-2022' + } + axis { + name 'PKR_VAR_image_type' + values 'docker' + } + } } agent { // Temporary forcing exception for windows/docker which is not finished yet diff --git a/build-jenkins-agent-ubuntu.pkr.hcl b/build-jenkins-agent-ubuntu.pkr.hcl index 8eb9b9721..296b4ec54 100644 --- a/build-jenkins-agent-ubuntu.pkr.hcl +++ b/build-jenkins-agent-ubuntu.pkr.hcl @@ -12,7 +12,7 @@ build { name = "ubuntu" image_offer = "0001-com-ubuntu-server-focal" image_publisher = "canonical" - image_sku = "${local.agent_os_version_safe}-lts-gen2" + image_sku = local.azure_sku[local.agent] os_type = "Linux" vm_size = local.azure_vm_size } diff --git a/build-jenkins-agent-windows.pkr.hcl b/build-jenkins-agent-windows.pkr.hcl index ff66d8549..bf09d6d40 100644 --- a/build-jenkins-agent-windows.pkr.hcl +++ b/build-jenkins-agent-windows.pkr.hcl @@ -14,7 +14,7 @@ build { communicator = "winrm" image_offer = "WindowsServer" image_publisher = "MicrosoftWindowsServer" - image_sku = "${var.agent_os_version}-datacenter-core-with-containers-smalldisk-g2" + image_sku = local.azure_sku[local.agent] vm_size = local.azure_vm_size os_type = "Windows" os_disk_size_gb = local.windows_disk_size_gb diff --git a/datasources.pkr.hcl b/datasources.pkr.hcl index e67efe24b..fef6521f8 100644 --- a/datasources.pkr.hcl +++ b/datasources.pkr.hcl @@ -20,3 +20,14 @@ data "amazon-ami" "windows-2019" { owners = ["amazon"] region = var.aws_region } + +data "amazon-ami" "windows-2022" { + filters = { + name = "Windows_Server-2022-English-Core-ContainersLatest-*" + root-device-type = "ebs" + virtualization-type = "hvm" + } + most_recent = true + owners = ["amazon"] + region = var.aws_region +} diff --git a/locals.pkr.hcl b/locals.pkr.hcl index e10acbfa7..a10fa4e97 100644 --- a/locals.pkr.hcl +++ b/locals.pkr.hcl @@ -12,6 +12,11 @@ locals { "amazon-ebs" = "Administrator" # In AWS EC2, WinRM super admin must be the "Administrator" account "docker" = "packer" } + azure_sku = { + "windows-2019" = "2019-datacenter-core-with-containers-smalldisk-g2" + "windows-2022" = "2022-Datacenter" + "ubuntu-20.04" = "20_04-lts-gen2" + } azure_vm_size = "Standard_D4s_v3" # Huge size requires - avoid https:#docs.microsoft.com/en-us/azure/virtual-machines/linux/image-builder-troubleshoot#sysprep-timing and avoid full disk (DS2v2 only have 14 Gb SSD for system) azure_resource_group = "${var.build_type}-packer-images" azure_galleries = {