From fe1c6f10483d90ae779b4229627673587ed999d6 Mon Sep 17 00:00:00 2001 From: Steve Brasier Date: Tue, 5 Nov 2024 19:53:15 +0000 Subject: [PATCH] simplify packer groups --- .github/workflows/nightlybuild.yml | 4 ++-- packer/openstack.pkr.hcl | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nightlybuild.yml b/.github/workflows/nightlybuild.yml index c97a18e51..9ab347d0f 100644 --- a/.github/workflows/nightlybuild.yml +++ b/.github/workflows/nightlybuild.yml @@ -31,7 +31,7 @@ jobs: - ["update", "ofed", "cuda"] exclude: - source_image_name: Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2 - inventory_groups: ["update", "ofed", "cuda"] + inventory_groups: 'update,ofed,cuda' env: ANSIBLE_FORCE_COLOR: True OS_CLOUD: openstack @@ -89,7 +89,7 @@ jobs: -var source_image_name=${{ matrix.source_image_name }} \ -var image_name_prefix=rocky-${{ matrix.os_version }} \ -var image_name_suffix=${{ env.IMAGE_NAME_SUFFIX }} \ - -var 'inventory_groups=${{ toJSON(matrix.inventory_groups) }}' \ + -var inventory_groups=${{ matrix.inventory_groups }} \ openstack.pkr.hcl env: PACKER_LOG: '1' diff --git a/packer/openstack.pkr.hcl b/packer/openstack.pkr.hcl index 6fb04986b..ef94adb4e 100644 --- a/packer/openstack.pkr.hcl +++ b/packer/openstack.pkr.hcl @@ -138,7 +138,8 @@ variable "metadata" { } variable "inventory_groups" { - type = list(string) + type = string + description = "comma-separated list of inventory groups, in addition to 'builder'" default = [] } @@ -157,6 +158,7 @@ variable "inventory_groups" { variable "image_name_prefix" { type = string description = "Prefix for built image names" + # TODO: maybe we can just make this default to the first two parts of the source image name? default = "openhpc" } @@ -171,7 +173,7 @@ source "openstack" "openhpc" { flavor = var.flavor use_blockstorage_volume = var.use_blockstorage_volume volume_type = var.volume_type - volume_size = contains(var.inventory_groups, "cuda") ? var.volume_size_cuda : var.volume_size + volume_size = contains(split(",", var.inventory_groups), "cuda") ? var.volume_size_cuda : var.volume_size metadata = var.metadata instance_metadata = {ansible_init_disable = "true"} networks = var.networks @@ -206,7 +208,7 @@ build { provisioner "ansible" { playbook_file = "${var.repo_root}/ansible/fatimage.yml" - groups = concat(["builder"], var.inventory_groups) + groups = concat(["builder"], split(",", var.inventory_groups)) keep_inventory_file = true # for debugging use_proxy = false # see https://www.packer.io/docs/provisioners/ansible#troubleshooting extra_arguments = [