Skip to content

Commit

Permalink
Merge pull request #1442 from smerle33/ssh/windows2019
Browse files Browse the repository at this point in the history
fix(windows): pin windows image version
  • Loading branch information
smerle33 authored Oct 10, 2024
2 parents f6efeef + 81bc475 commit fb431ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build-jenkins-agent-ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ build {
}

provisioner "shell" {
execute_command = "{{ .Vars }} sudo -E su - jenkins -c \"bash -eu '{{ .Path }}'\""
environment_vars = local.provisioning_env_vars
execute_command = "{{ .Vars }} sudo -E su - jenkins -c \"bash -eu '{{ .Path }}'\""
environment_vars = local.provisioning_env_vars
inline = [
"source /home/jenkins/.asdf/asdf.sh", # Required as this is a non-interactive and non-login `bash`
"goss --version",
Expand Down
9 changes: 5 additions & 4 deletions build-jenkins-agent-windows.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ build {
image_publisher = "MicrosoftWindowsServer"
# List available SKUs with the command `az vm image list-skus --offer WindowsServer --location eastus --publisher MicrosoftWindowsServer --output table`
image_sku = "${var.agent_os_version}-datacenter-core-g2"
image_version = local.windows_image_version[var.agent_os_version]
os_type = "Windows"
os_disk_size_gb = local.windows_disk_size_gb
winrm_insecure = true
Expand Down Expand Up @@ -89,7 +90,7 @@ build {
destination = "C:/goss-windows.yaml"
}

provisioner "file" {
provisioner "file" {
source = "./tests/goss-common.yaml"
destination = "C:/goss-common.yaml"
}
Expand All @@ -100,8 +101,8 @@ build {
}

provisioner "powershell" {
pause_before = "2m" # long pause as 1m is not enough
environment_vars = local.provisioning_env_vars
pause_before = "2m" # long pause as 1m is not enough
environment_vars = local.provisioning_env_vars
inline = [
"$ErrorActionPreference = 'Stop'",
"goss --version",
Expand All @@ -112,7 +113,7 @@ build {
}

provisioner "powershell" {
environment_vars = local.provisioning_env_vars
environment_vars = local.provisioning_env_vars
inline = [
"Remove-Item -Force C:/goss-windows.yaml",
"Remove-Item -Force C:/goss-common.yaml",
Expand Down
8 changes: 8 additions & 0 deletions locals.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ locals {
"azure-arm" = "packer"
"docker" = "packer"
}

# List available images `az vm image list --location eastus --publisher MicrosoftWindowsServer --offer WindowsServer --sku 2022-datacenter-core-g2 --all --output table`
windows_image_version = {
"2019" = "17763.6293.240905"
"2022" = "20348.2762.241006"
"22.04" = "latest" #just to avoid error on run for linux, but not used
}

azure_vm_size = {
"amd64" = "Standard_D4ads_v5" # 4 CPU / 16 GB / Huge size required to 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)
"arm64" = "Standard_D4pds_v5" # 4 CPU / 16 GB
Expand Down

0 comments on commit fb431ea

Please sign in to comment.