Skip to content

Commit 24d1ee0

Browse files
committed
allow adding suffix to image names
1 parent 3ead8d8 commit 24d1ee0

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packer/openstack.pkr.hcl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ variable "extra_build_image_name" {
171171
default = "extra"
172172
}
173173

174+
variable "image_name_suffx" {
175+
type = string
176+
description = "Suffix for all build image names"
177+
default = ""
178+
}
179+
174180
source "openstack" "openhpc" {
175181
# Build VM:
176182
flavor = var.flavor
@@ -207,31 +213,31 @@ build {
207213
# latest nightly image:
208214
source "source.openstack.openhpc" {
209215
name = "rocky-latest"
210-
image_name = "${source.name}-${var.os_version}"
216+
image_name = "${source.name}-${var.os_version}${var.image_name_suffx}"
211217
}
212218

213219
# latest nightly cuda image:
214220
source "source.openstack.openhpc" {
215221
name = "rocky-latest-cuda"
216-
image_name = "${source.name}-${var.os_version}"
222+
image_name = "${source.name}-${var.os_version}${var.image_name_suffx}"
217223
}
218224

219225
# OFED fat image:
220226
source "source.openstack.openhpc" {
221227
name = "openhpc"
222-
image_name = "${source.name}-${var.os_version}-${local.timestamp}-${substr(local.git_commit, 0, 8)}"
228+
image_name = "${source.name}-${var.os_version}-${local.timestamp}-${substr(local.git_commit, 0, 8)}${var.image_name_suffx}"
223229
}
224230

225231
# CUDA fat image:
226232
source "source.openstack.openhpc" {
227233
name = "openhpc-cuda"
228-
image_name = "${source.name}-${var.os_version}-${local.timestamp}-${substr(local.git_commit, 0, 8)}"
234+
image_name = "${source.name}-${var.os_version}-${local.timestamp}-${substr(local.git_commit, 0, 8)}${var.image_name_suffx}"
229235
}
230236

231237
# Extended site-specific image, built on fat image:
232238
source "source.openstack.openhpc" {
233239
name = "openhpc-extra"
234-
image_name = "openhpc-${var.extra_build_image_name}-${var.os_version}-${local.timestamp}-${substr(local.git_commit, 0, 8)}"
240+
image_name = "openhpc-${var.extra_build_image_name}-${var.os_version}-${local.timestamp}-${substr(local.git_commit, 0, 8)}${var.image_name_suffx}"
235241
}
236242

237243
provisioner "ansible" {

0 commit comments

Comments
 (0)