forked from pytorch/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindows.pkr.hcl
More file actions
123 lines (111 loc) · 3.72 KB
/
Copy pathwindows.pkr.hcl
File metadata and controls
123 lines (111 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
data "amazon-ami" "windows_root_ami" {
filters = {
name = "Windows_Server-2019-English-Tesla-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["amazon"]
region = "us-east-1"
}
locals {
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
}
source "amazon-ebs" "windows_ebs_builder" {
ami_name = "Windows 2019 GHA CI - ${local.timestamp}"
associate_public_ip_address = true
communicator = "winrm"
instance_type = "g5.4xlarge"
launch_block_device_mappings {
delete_on_termination = true
device_name = "/dev/sda1"
volume_size = 128
}
source_ami = "${data.amazon-ami.windows_root_ami.id}"
region = "us-east-1"
ami_regions = ["us-east-1"]
user_data_file = "user-data-scripts/bootstrap-winrm.ps1"
winrm_insecure = true
winrm_use_ssl = true
winrm_username = "Administrator"
skip_create_ami = var.skip_create_ami
aws_polling {
# For some reason the AMIs take a really long time to be ready so just assume it'll take a while
max_attempts = 600
}
}
build {
sources = ["source.amazon-ebs.windows_ebs_builder"]
# Install conda, it needs to be installed under SYSTEM to avoid this broken
# installation https://github.com/ContinuumIO/anaconda-issues/issues/11799.
provisioner "powershell" {
elevated_user = "SYSTEM"
elevated_password = ""
scripts = [
"${path.root}/scripts/Installers/Install-Miniconda3.ps1",
"${path.root}/scripts/Installers/Initialize-Python3.ps1",
"${path.root}/scripts/Installers/Install-Conda-Dependencies.ps1",
"${path.root}/scripts/Installers/Install-Pip-Dependencies.ps1",
]
}
# Install sshd_config
provisioner "file" {
source = "${path.root}/configs/sshd_config"
destination = "C:\\ProgramData\\ssh\\sshd_config"
}
# Install ssh server
provisioner "powershell" {
elevated_user = "SYSTEM"
elevated_password = ""
scripts = [
"${path.root}/scripts/Installers/Install-SSH.ps1",
]
}
# Install the Visual Studio 2022
provisioner "powershell" {
environment_vars = ["INSTALL_WINDOWS_SDK=1", "VS_YEAR=2022", "VS_VERSION=17.4.1", "VS_UNINSTALL_PREVIOUS=0"]
execution_policy = "unrestricted"
scripts = [
"${path.root}/scripts/Installers/Install-VS.ps1",
]
}
# Install the rest of the dependencies
# Please note: When modifying Microsoft.PowerShell_profile for a user
# all modifications need to be done to Install-Choco-GenerateProfile script
provisioner "powershell" {
execution_policy = "unrestricted"
scripts = [
"${path.root}/scripts/Helpers/Reset-UserData.ps1",
"${path.root}/scripts/Installers/Install-Choco-GenerateProfile.ps1",
"${path.root}/scripts/Installers/Initialize-Python3.ps1",
"${path.root}/scripts/Installers/Install-Tools.ps1",
]
}
provisioner "powershell" {
environment_vars = ["CUDA_VERSION=12.6"]
scripts = [
"${path.root}/scripts/Installers/Install-CUDA-Tools.ps1",
]
}
provisioner "powershell" {
environment_vars = ["CUDA_VERSION=12.8"]
scripts = [
"${path.root}/scripts/Installers/Install-CUDA-Tools.ps1",
]
}
provisioner "powershell" {
environment_vars = ["CUDA_VERSION=12.9"]
scripts = [
"${path.root}/scripts/Installers/Install-CUDA-Tools.ps1",
]
}
# Uninstall Windows Defender, it brings more trouble than it's worth. Do this
# last as it screws up the installation of other services like sshd somehow
provisioner "powershell" {
elevated_user = "SYSTEM"
elevated_password = ""
scripts = [
"${path.root}/scripts/Helpers/Uninstall-WinDefend.ps1",
]
}
}