Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(windows) bump Windows Server to 2022 edition #219

Merged
merged 1 commit into from
May 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}