@@ -23,6 +23,7 @@ data "git-commit" "cwd-head" { }
23
23
locals {
24
24
git_commit = data. git-commit . cwd-head . hash
25
25
timestamp = formatdate (" YYMMDD-hhmm" , timestamp ())
26
+ image_name_suffix = var. image_name_suffix == " " ? " ${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} " : var. image_name_suffix
26
27
}
27
28
28
29
# Path pointing to root of repository - automatically set by environment variable PKR_VAR_repo_root
@@ -39,12 +40,6 @@ variable "networks" {
39
40
type = list (string )
40
41
}
41
42
42
- variable "os_version" {
43
- type = string
44
- description = " 'RL8' or 'RL9' with default source_image_* mappings"
45
- default = " RL9"
46
- }
47
-
48
43
# Must supply either source_image_name or source_image_id
49
44
variable "source_image_name" {
50
45
type = string
@@ -123,19 +118,13 @@ variable "volume_type" {
123
118
}
124
119
125
120
variable "volume_size" {
126
- type = map (number )
127
- default = {
128
- # fat image builds, GB:
129
- rocky-latest = 15
130
- rocky-latest-cuda = 30
131
- openhpc = 15
132
- openhpc-cuda = 30
133
- }
121
+ type = number
122
+ default = 15 # same as default non-CUDA build
134
123
}
135
124
136
- variable "extra_build_volume_size " {
125
+ variable "volume_size_cuda " {
137
126
type = number
138
- default = 15 # same as default non-CUDA build
127
+ default = 30
139
128
}
140
129
141
130
variable "image_disk_format" {
@@ -148,32 +137,32 @@ variable "metadata" {
148
137
default = {}
149
138
}
150
139
151
- variable "groups" {
152
- type = map (list (string ))
153
- description = " Additional inventory groups (other than 'builder') to add build VM to, keyed by source name"
154
- default = {
155
- # fat image builds:
156
- rocky-latest = [" update" , " ofed" ]
157
- rocky-latest-cuda = [" update" , " ofed" , " cuda" ]
158
- openhpc = [" control" , " compute" , " login" ]
159
- openhpc-cuda = [" control" , " compute" , " login" ]
160
- }
161
- }
162
-
163
- variable "extra_build_groups" {
140
+ variable "inventory_groups" {
164
141
type = list (string )
165
142
default = []
166
143
}
167
144
168
- variable "extra_build_image_name" {
145
+ # variable "groups" {
146
+ # type = map(list(string))
147
+ # description = "Additional inventory groups (other than 'builder') to add build VM to, keyed by source name"
148
+ # default = {
149
+ # fat image builds:
150
+ # rocky-latest = ["update", "ofed"]
151
+ # rocky-latest-cuda = ["update", "ofed", "cuda"]
152
+ # openhpc = ["control", "compute", "login"]
153
+ # openhpc-cuda = ["control", "compute", "login"]
154
+ # }
155
+ # }
156
+
157
+ variable "image_name_prefix" {
169
158
type = string
170
- description = " Infix for 'extra' build image name "
171
- default = " extra "
159
+ description = " Prefix for built image names "
160
+ default = " openhpc "
172
161
}
173
162
174
163
variable "image_name_suffix" {
175
164
type = string
176
- description = " Suffix for all build image names"
165
+ description = " Suffix for built image names. If not supplied a timestamp+git commit is used "
177
166
default = " "
178
167
}
179
168
@@ -182,7 +171,7 @@ source "openstack" "openhpc" {
182
171
flavor = var. flavor
183
172
use_blockstorage_volume = var. use_blockstorage_volume
184
173
volume_type = var. volume_type
185
- volume_size = lookup (var. volume_size , source . name , var. extra_build_volume_size )
174
+ volume_size = contains (var. inventory_groups , " cuda " ) ? var . volume_size_cuda : var. volume_size
186
175
metadata = var. metadata
187
176
instance_metadata = {ansible_init_disable = " true" }
188
177
networks = var. networks
@@ -210,39 +199,14 @@ source "openstack" "openhpc" {
210
199
211
200
build {
212
201
213
- # latest nightly image:
214
202
source "source.openstack.openhpc" {
215
203
name = " rocky-latest"
216
- image_name = " ${ source . name } -${ var . os_version } ${ var . image_name_suffix } "
217
- }
218
-
219
- # latest nightly cuda image:
220
- source "source.openstack.openhpc" {
221
- name = " rocky-latest-cuda"
222
- image_name = " ${ source . name } -${ var . os_version } ${ var . image_name_suffix } "
223
- }
224
-
225
- # OFED fat image:
226
- source "source.openstack.openhpc" {
227
- name = " openhpc"
228
- image_name = " ${ source . name } -${ var . os_version } -${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} ${ var . image_name_suffix } "
229
- }
230
-
231
- # CUDA fat image:
232
- source "source.openstack.openhpc" {
233
- name = " openhpc-cuda"
234
- image_name = " ${ source . name } -${ var . os_version } -${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} ${ var . image_name_suffix } "
235
- }
236
-
237
- # Extended site-specific image, built on fat image:
238
- source "source.openstack.openhpc" {
239
- name = " openhpc-extra"
240
- image_name = " openhpc-${ var . extra_build_image_name } -${ var . os_version } -${ local . timestamp } -${ substr (local. git_commit , 0 , 8 )} ${ var . image_name_suffix } "
204
+ image_name = " ${ var . image_name_prefix } -${ local . image_name_suffix } "
241
205
}
242
206
243
207
provisioner "ansible" {
244
208
playbook_file = " ${ var . repo_root } /ansible/fatimage.yml"
245
- groups = concat ([" builder" ], lookup ( var. groups , source . name , var . extra_build_groups ) )
209
+ groups = concat ([" builder" ], var. inventory_groups )
246
210
keep_inventory_file = true # for debugging
247
211
use_proxy = false # see https://www.packer.io/docs/provisioners/ansible#troubleshooting
248
212
extra_arguments = [
0 commit comments