Skip to content

Commit fe719d9

Browse files
authored
Merge pull request #266 from stackhpc/feat/packer-build-from-source-image-id
Allow source images to be specified by UUID or name
2 parents bbd869e + 05d587a commit fe719d9

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

environments/.stackhpc/builder.pkrvars.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
flavor = "vm.ska.cpu.general.small"
22
networks = ["a262aabd-e6bf-4440-a155-13dbc1b5db0e"] # WCDC-iLab-60
33
source_image_name = "openhpc-230503-0944-bf8c3f63.qcow2" # https://github.com/stackhpc/ansible-slurm-appliance/pull/252
4-
#source_image_name = "Rocky-8-GenericCloud-Base-8.7-20221130.0.x86_64.qcow2"
4+
fatimage_source_image_name = "Rocky-8-GenericCloud-8.6.20220702.0.x86_64.qcow2"
55
ssh_keypair_name = "slurm-app-ci"
66
security_groups = ["default", "SSH"]
77
ssh_bastion_host = "128.232.222.183"

packer/openstack.pkr.hcl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,26 @@ variable "networks" {
3131
type = list(string)
3232
}
3333

34+
# Must supply either source_image_name or source_image
3435
variable "source_image_name" {
3536
type = string
37+
default = null
3638
}
3739

40+
variable "source_image" {
41+
type = string
42+
default = null
43+
}
44+
45+
# Must supply either fatimage_source_image_name or fatimage_source_image
3846
variable "fatimage_source_image_name" {
3947
type = string
40-
default = "Rocky-8-GenericCloud-8.6.20220702.0.x86_64.qcow2"
48+
default = null
49+
}
50+
51+
variable "fatimage_source_image" {
52+
type = string
53+
default = null
4154
}
4255

4356
variable "flavor" {
@@ -101,6 +114,7 @@ source "openstack" "openhpc" {
101114
build {
102115
source "source.openstack.openhpc" {
103116
name = "compute"
117+
source_image = "${var.source_image}"
104118
source_image_name = "${var.source_image_name}" # NB: must already exist in OpenStack
105119
image_name = "ohpc-${source.name}-${local.timestamp}-${substr(local.git_commit, 0, 8)}.qcow2" # also provides a unique legal instance hostname (in case of parallel packer builds)
106120
}
@@ -123,6 +137,7 @@ build {
123137
# The "fat" image build with all binaries:
124138
build {
125139
source "source.openstack.openhpc" {
140+
source_image = "${var.fatimage_source_image}"
126141
source_image_name = "${var.fatimage_source_image_name}" # NB: must already exist in OpenStack
127142
image_name = "${source.name}-${local.timestamp}-${substr(local.git_commit, 0, 8)}.qcow2" # similar to name from slurm_image_builder
128143
}

0 commit comments

Comments
 (0)