-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathbuild.ubuntu-24_04.pkr.hcl
More file actions
236 lines (205 loc) · 10.2 KB
/
build.ubuntu-24_04.pkr.hcl
File metadata and controls
236 lines (205 loc) · 10.2 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
build {
sources = ["source.azure-arm.image"]
name = "ubuntu-24_04"
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
inline = ["mkdir ${var.image_folder}", "chmod 777 ${var.image_folder}"]
}
provisioner "file" {
destination = "${var.helper_script_folder}"
source = "${path.root}/../scripts/helpers"
}
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
script = "${path.root}/../scripts/build/configure-apt-mock.sh"
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}","DEBIAN_FRONTEND=noninteractive"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = [
"${path.root}/../scripts/build/install-ms-repos.sh",
"${path.root}/../scripts/build/configure-apt-sources.sh",
"${path.root}/../scripts/build/configure-apt.sh"
]
}
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
script = "${path.root}/../scripts/build/configure-limits.sh"
}
provisioner "file" {
destination = "${var.installer_script_folder}"
source = "${path.root}/../scripts/build"
}
provisioner "file" {
destination = "${var.image_folder}"
sources = [
"${path.root}/../assets/post-gen",
"${path.root}/../scripts/tests",
"${path.root}/../scripts/docs-gen"
]
}
provisioner "file" {
destination = "${var.image_folder}/docs-gen/"
source = "${path.root}/../../../helpers/software-report-base"
}
provisioner "file" {
destination = "${var.installer_script_folder}/toolset.json"
source = "${path.root}/../toolsets/toolset-2404.json"
}
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
inline = [
"mv ${var.image_folder}/docs-gen ${var.image_folder}/SoftwareReport",
"mv ${var.image_folder}/post-gen ${var.image_folder}/post-generation"
]
}
provisioner "shell" {
environment_vars = ["IMAGE_VERSION=${var.image_version}", "IMAGEDATA_FILE=${var.imagedata_file}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/configure-image-data.sh"]
}
provisioner "shell" {
environment_vars = ["IMAGE_VERSION=${var.image_version}", "IMAGE_OS=${var.image_os}", "HELPER_SCRIPTS=${var.helper_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/configure-environment.sh"]
}
provisioner "shell" {
environment_vars = ["DEBIAN_FRONTEND=noninteractive", "HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/install-apt-vital.sh"]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/install-powershell.sh"]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/Install-PowerShellModules.ps1", "${path.root}/../scripts/build/Install-PowerShellAzModules.ps1"]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "DEBIAN_FRONTEND=noninteractive"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = [
"${path.root}/../scripts/build/install-actions-cache.sh",
"${path.root}/../scripts/build/install-apt-common.sh",
"${path.root}/../scripts/build/install-azcopy.sh",
"${path.root}/../scripts/build/install-azure-cli.sh",
"${path.root}/../scripts/build/install-azure-devops-cli.sh",
"${path.root}/../scripts/build/install-bicep.sh",
"${path.root}/../scripts/build/install-apache.sh",
"${path.root}/../scripts/build/install-aws-tools.sh",
"${path.root}/../scripts/build/install-clang.sh",
"${path.root}/../scripts/build/install-swift.sh",
"${path.root}/../scripts/build/install-cmake.sh",
"${path.root}/../scripts/build/install-codeql-bundle.sh",
"${path.root}/../scripts/build/install-container-tools.sh",
"${path.root}/../scripts/build/install-dotnetcore-sdk.sh",
"${path.root}/../scripts/build/install-microsoft-edge.sh",
"${path.root}/../scripts/build/install-gcc-compilers.sh",
"${path.root}/../scripts/build/install-firefox.sh",
"${path.root}/../scripts/build/install-gfortran.sh",
"${path.root}/../scripts/build/install-git.sh",
"${path.root}/../scripts/build/install-git-lfs.sh",
"${path.root}/../scripts/build/install-github-cli.sh",
"${path.root}/../scripts/build/install-google-chrome.sh",
"${path.root}/../scripts/build/install-google-cloud-cli.sh",
"${path.root}/../scripts/build/install-haskell.sh",
"${path.root}/../scripts/build/install-java-tools.sh",
"${path.root}/../scripts/build/install-kubernetes-tools.sh",
"${path.root}/../scripts/build/install-miniconda.sh",
"${path.root}/../scripts/build/install-kotlin.sh",
"${path.root}/../scripts/build/install-mysql.sh",
"${path.root}/../scripts/build/install-nginx.sh",
"${path.root}/../scripts/build/install-nvm.sh",
"${path.root}/../scripts/build/install-nodejs.sh",
"${path.root}/../scripts/build/install-bazel.sh",
"${path.root}/../scripts/build/install-php.sh",
"${path.root}/../scripts/build/install-postgresql.sh",
"${path.root}/../scripts/build/install-pulumi.sh",
"${path.root}/../scripts/build/install-ruby.sh",
"${path.root}/../scripts/build/install-rust.sh",
"${path.root}/../scripts/build/install-julia.sh",
"${path.root}/../scripts/build/install-selenium.sh",
"${path.root}/../scripts/build/install-packer.sh",
"${path.root}/../scripts/build/install-vcpkg.sh",
"${path.root}/../scripts/build/configure-dpkg.sh",
"${path.root}/../scripts/build/install-yq.sh",
"${path.root}/../scripts/build/install-android-sdk.sh",
"${path.root}/../scripts/build/install-pypy.sh",
"${path.root}/../scripts/build/install-python.sh",
"${path.root}/../scripts/build/install-zstd.sh",
"${path.root}/../scripts/build/install-ninja.sh",
"${path.root}/../scripts/build/install-copilot-cli.sh"
]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/install-docker.sh"]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/Install-Toolset.ps1", "${path.root}/../scripts/build/Configure-Toolset.ps1"]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/install-pipx-packages.sh"]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "DEBIAN_FRONTEND=noninteractive", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
execute_command = "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/install-homebrew.sh"]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/configure-snap.sh"]
}
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
script = "${path.root}/../scripts/build/list-dpkg.sh"
}
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
expect_disconnect = true
inline = ["echo 'Reboot VM'", "sudo reboot"]
}
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
pause_before = "5m0s"
scripts = ["${path.root}/../scripts/build/cleanup.sh"]
start_retry_timeout = "10m"
}
provisioner "shell" {
environment_vars = ["IMAGE_VERSION=${var.image_version}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"]
inline = ["pwsh -File ${var.image_folder}/SoftwareReport/Generate-SoftwareReport.ps1 -OutputDirectory ${var.image_folder}", "pwsh -File ${var.image_folder}/tests/RunAll-Tests.ps1 -OutputDirectory ${var.image_folder}"]
}
provisioner "file" {
destination = "${path.root}/../Ubuntu2404-Readme.md"
direction = "download"
source = "${var.image_folder}/software-report.md"
}
provisioner "file" {
destination = "${path.root}/../software-report.json"
direction = "download"
source = "${var.image_folder}/software-report.json"
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPT_FOLDER=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "IMAGE_FOLDER=${var.image_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/configure-system.sh"]
}
provisioner "shell" {
environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}"]
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
scripts = ["${path.root}/../scripts/build/post-build-validation.sh"]
}
provisioner "shell" {
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
inline = ["sleep 30", "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"]
}
}