File tree Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Expand file tree Collapse file tree 3 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 34
34
ANSIBLE_FORCE_COLOR : True
35
35
OS_CLOUD : openstack
36
36
CI_CLOUD : ${{ github.event.inputs.ci_cloud }}
37
+ SOURCE_IMAGES_MAP : |
38
+ {
39
+ "RL8": {
40
+ "openstack.openhpc": "rocky-latest-RL8",
41
+ "openstack.openhpc-cuda": "rocky-latest-cuda-RL8"
42
+ },
43
+ "RL9": {
44
+ "openstack.openhpc": "rocky-latest-RL9",
45
+ "openstack.openhpc-cuda": "rocky-latest-cuda-RL9"
46
+ }
47
+ }
37
48
38
49
steps :
39
50
- uses : actions/checkout@v2
@@ -77,17 +88,13 @@ jobs:
77
88
cd packer/
78
89
packer init .
79
90
80
- if [[ "${{ matrix.build }}" == *"cuda"* ]]; then
81
- SOURCE_IMAGE_NAME="rocky-latest-cuda"
82
- else
83
- SOURCE_IMAGE_NAME="rocky-latest"
84
- fi
91
+ SOURCE_IMAGE=${{ fromJSON(env.SOURCE_IMAGES_MAP)[matrix.os_version][matrix.build] }}
85
92
86
93
PACKER_LOG=1 packer build \
87
94
-on-error=${{ vars.PACKER_ON_ERROR }} \
88
95
-only=${{ matrix.build }} \
89
96
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
90
- -var "source_image_name={\"${{ matrix.os_version }}\":\"${SOURCE_IMAGE_NAME}-${{ matrix.os_version }}\" }" \
97
+ -var "source_image_name=${SOURCE_IMAGE }" \
91
98
openstack.pkr.hcl
92
99
env :
93
100
PKR_VAR_os_version : ${{ matrix.os_version }}
Original file line number Diff line number Diff line change 37
37
ANSIBLE_FORCE_COLOR : True
38
38
OS_CLOUD : openstack
39
39
CI_CLOUD : ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
40
+ SOURCE_IMAGES_MAP : |
41
+ {
42
+ "RL8": "Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2",
43
+ "RL9": "Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2"
44
+ }
45
+
40
46
steps :
41
47
- uses : actions/checkout@v2
42
48
@@ -79,10 +85,13 @@ jobs:
79
85
cd packer/
80
86
packer init .
81
87
88
+ SOURCE_IMAGE=${{ fromJSON(env.SOURCE_IMAGES_MAP)[matrix.os_version] }}
89
+
82
90
PACKER_LOG=1 packer build \
83
91
-on-error=${{ vars.PACKER_ON_ERROR }} \
84
92
-only=${{ matrix.build }} \
85
93
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
94
+ -var "source_image_name=${SOURCE_IMAGE}"
86
95
openstack.pkr.hcl
87
96
88
97
env :
Original file line number Diff line number Diff line change @@ -47,12 +47,8 @@ variable "os_version" {
47
47
48
48
# Must supply either source_image_name or source_image_id
49
49
variable "source_image_name" {
50
- type = map (string )
51
- description = " name of source image, keyed from var.os_version"
52
- default = {
53
- RL8: " Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2"
54
- RL9: " Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2"
55
- }
50
+ type = string
51
+ description = " name of source image"
56
52
}
57
53
58
54
variable "source_image" {
@@ -173,8 +169,8 @@ source "openstack" "openhpc" {
173
169
security_groups = var. security_groups
174
170
175
171
# Input image:
176
- source_image = " ${ var . source_image [ var . os_version ] } "
177
- source_image_name = " ${ var . source_image_name [ var . os_version ] } " # NB: must already exist in OpenStack
172
+ source_image = " ${ var . source_image } "
173
+ source_image_name = " ${ var . source_image_name } " # NB: must already exist in OpenStack
178
174
179
175
# SSH:
180
176
ssh_username = var. ssh_username
You can’t perform that action at this time.
0 commit comments