Skip to content

Commit

Permalink
feat: add Windows Server 2022 VM templates
Browse files Browse the repository at this point in the history
Signed-off-by: Damien Duportal <[email protected]>
  • Loading branch information
dduportal committed May 22, 2022
1 parent ef3658c commit 60ac33c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
12 changes: 11 additions & 1 deletion Jenkinsfile_k8s
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -133,6 +133,16 @@ pipeline {
values 'docker'
}
}
exclude {
axis {
name 'agent_type'
values 'windows-2022'
}
axis {
name 'compute_type'
values 'docker'
}
}
}
agent {
label "linux-${env.cpu_architecture}-docker"
Expand Down
6 changes: 3 additions & 3 deletions build-jenkins-agent-windows.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ build {
provisioner "windows-restart" {
max_retries = 3
}
# This provisioner must be the last for Azure builds, after reboots
provisioner "powershell" {
only = ["azure-arm.windows"]
elevated_user = local.windows_winrm_user[var.image_type]
Expand All @@ -64,15 +65,14 @@ build {
source = "./provisioning/EC2-LaunchConfig.json"
destination = "C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Config\\LaunchConfig.json"
}
# This provisioner must be the last for AWS EBS builds, after reboots
provisioner "powershell" {
only = ["amazon-ebs.windows"]
elevated_user = local.windows_winrm_user[var.image_type]
elevated_password = build.Password
# Ref. https:#docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-scripts-subsequent
inline = [
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SendWindowsIsReady.ps1 -Schedule",
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule",
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown"
"if($env:AGENT_OS_VERSION = '2019') { C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SendWindowsIsReady.ps1 -Schedule; C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule; C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown;};"
]
}
}
11 changes: 11 additions & 0 deletions datasources.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 60ac33c

Please sign in to comment.