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 3434 ANSIBLE_FORCE_COLOR : True
3535 OS_CLOUD : openstack
3636 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+ }
3748
3849 steps :
3950 - uses : actions/checkout@v2
@@ -77,17 +88,13 @@ jobs:
7788 cd packer/
7889 packer init .
7990
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] }}
8592
8693 PACKER_LOG=1 packer build \
8794 -on-error=${{ vars.PACKER_ON_ERROR }} \
8895 -only=${{ matrix.build }} \
8996 -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 }" \
9198 openstack.pkr.hcl
9299 env :
93100 PKR_VAR_os_version : ${{ matrix.os_version }}
Original file line number Diff line number Diff line change 3737 ANSIBLE_FORCE_COLOR : True
3838 OS_CLOUD : openstack
3939 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+
4046 steps :
4147 - uses : actions/checkout@v2
4248
@@ -79,10 +85,13 @@ jobs:
7985 cd packer/
8086 packer init .
8187
88+ SOURCE_IMAGE=${{ fromJSON(env.SOURCE_IMAGES_MAP)[matrix.os_version] }}
89+
8290 PACKER_LOG=1 packer build \
8391 -on-error=${{ vars.PACKER_ON_ERROR }} \
8492 -only=${{ matrix.build }} \
8593 -var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
94+ -var "source_image_name=${SOURCE_IMAGE}"
8695 openstack.pkr.hcl
8796
8897 env :
Original file line number Diff line number Diff line change @@ -47,12 +47,8 @@ variable "os_version" {
4747
4848# Must supply either source_image_name or source_image_id
4949variable "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"
5652}
5753
5854variable "source_image" {
@@ -173,8 +169,8 @@ source "openstack" "openhpc" {
173169 security_groups = var. security_groups
174170
175171 # 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
178174
179175 # SSH:
180176 ssh_username = var. ssh_username
You can’t perform that action at this time.
0 commit comments