Skip to content

Commit 21e06a1

Browse files
committed
enable fatimage build on either RL8 or RL9, inc on PRs
1 parent 7503b5f commit 21e06a1

File tree

4 files changed

+35
-48
lines changed

4 files changed

+35
-48
lines changed

.github/workflows/fatimage.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11

22
name: Build fat image
3-
on:
3+
'on':
44
workflow_dispatch:
5+
inputs:
6+
use_RL9:
7+
required: true
8+
description: Include RL9 image build
9+
type: boolean
10+
default: false
511
jobs:
612
openstack:
713
name: openstack-imagebuild
8-
concurrency: ${{ github.ref }} # to branch/PR
14+
concurrency: ${{ github.ref }}-{{ matrix.os_version }} # to branch/PR + OS
915
runs-on: ubuntu-20.04
16+
strategy:
17+
matrix:
18+
os_version: [RL8, RL9]
19+
rl9_selected:
20+
- ${{ inputs.use_RL9 == true }} # only potentially true for workflow_dispatch
21+
exclude:
22+
- os_version: RL9
23+
rl9_selected: false
1024
env:
1125
ANSIBLE_FORCE_COLOR: True
1226
OS_CLOUD: openstack
@@ -48,6 +62,8 @@ jobs:
4862
cd packer/
4963
packer init .
5064
PACKER_LOG=1 packer build -only openstack.openhpc -on-error=${{ vars.PACKER_ON_ERROR }} -var-file=$PKR_VAR_environment_root/${{ vars.CI_CLOUD }}.pkrvars.hcl openstack.pkr.hcl
65+
env:
66+
PKR_VAR_os_version: ${{ matrix.os_version }}
5167

5268
- name: Get created image name from manifest
5369
id: manifest

environments/.stackhpc/ARCUS.pkrvars.hcl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
flavor = "vm.ska.cpu.general.small"
22
use_blockstorage_volume = true
3-
volume_size = 12 # GB. Compatible with SMS-lab's general.v1.tiny
3+
volume_size = 12 # GB. Compatible with SMS-lab's general.v1.tiny
44
image_disk_format = "qcow2"
55
networks = ["4b6b2722-ee5b-40ec-8e52-a6610e14cc51"] # portal-internal (DNS broken on ilab-60)
6-
source_image_name = "openhpc-230804-1754-80b8d714" # https://github.com/stackhpc/ansible-slurm-appliance/pull/298
7-
fatimage_source_image_name = "Rocky-9-GenericCloud-Base-9.3-20231113.0.x86_64.qcow2"
86
ssh_keypair_name = "slurm-app-ci"
97
ssh_private_key_file = "~/.ssh/id_rsa"
108
security_groups = ["default", "SSH"]

environments/.stackhpc/LEAFCLOUD.pkrvars.hcl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ volume_size = 12 # GB. Compatible with SMS-lab's general.v1.tiny
44
volume_type = "unencrypted"
55
image_disk_format = "qcow2"
66
networks = ["909e49e8-6911-473a-bf88-0495ca63853c"] # slurmapp-ci
7-
source_image_name = "openhpc-230804-1754-80b8d714" # https://github.com/stackhpc/ansible-slurm-appliance/pull/298
8-
fatimage_source_image_name = "Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2"
97
ssh_keypair_name = "slurm-app-ci"
108
ssh_private_key_file = "~/.ssh/id_rsa"
119
security_groups = ["default", "SSH"]

packer/openstack.pkr.hcl

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,26 @@ variable "networks" {
3939
type = list(string)
4040
}
4141

42-
# Must supply either source_image_name or source_image
43-
variable "source_image_name" {
42+
# Must supply either fatimage_source_image_name or fatimage_source_image
43+
variable "os_version" {
4444
type = string
45-
default = null
45+
description = "RL8 or RL9"
4646
}
4747

48-
variable "source_image" {
49-
type = string
50-
default = null
51-
}
52-
53-
# Must supply either fatimage_source_image_name or fatimage_source_image
5448
variable "fatimage_source_image_name" {
55-
type = string
56-
default = null
49+
type = map(string)
50+
default = {
51+
RL8: "Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2"
52+
RL9: "Rocky-9-GenericCloud-Base-9.3-20231113.0.x86_64.qcow2"
53+
}
5754
}
5855

5956
variable "fatimage_source_image" {
60-
type = string
61-
default = null
57+
type = map(string)
58+
default = {
59+
RL8: null
60+
RL9: null
61+
}
6262
}
6363

6464
variable "flavor" {
@@ -159,38 +159,13 @@ source "openstack" "openhpc" {
159159
image_visibility = "${var.image_visibility}"
160160
}
161161

162-
# NB: build names, split on "-", are used to determine groups to add build to, so could build for a compute gpu group using e.g. `compute-gpu`.
163-
build {
164-
source "source.openstack.openhpc" {
165-
name = "compute"
166-
source_image = "${var.source_image}"
167-
source_image_name = "${var.source_image_name}" # NB: must already exist in OpenStack
168-
image_name = "ohpc-${source.name}-${local.timestamp}-${substr(local.git_commit, 0, 8)}" # also provides a unique legal instance hostname (in case of parallel packer builds)
169-
}
170-
171-
provisioner "ansible" {
172-
playbook_file = "${var.repo_root}/ansible/site.yml"
173-
groups = concat(["builder"], split("-", "${source.name}"))
174-
keep_inventory_file = true # for debugging
175-
use_proxy = false # see https://www.packer.io/docs/provisioners/ansible#troubleshooting
176-
extra_arguments = ["--limit", "builder", "-i", "${var.repo_root}/packer/ansible-inventory.sh", "-vv", "-e", "@${var.repo_root}/packer/${source.name}_extravars.yml"]
177-
}
178-
179-
post-processor "manifest" {
180-
output = "${var.manifest_output_path}"
181-
custom_data = {
182-
source = "${source.name}"
183-
}
184-
}
185-
}
186-
187162
# The "fat" image build with all binaries:
188163
build {
189164
source "source.openstack.openhpc" {
190165
floating_ip_network = "${var.floating_ip_network}"
191-
source_image = "${var.fatimage_source_image}"
192-
source_image_name = "${var.fatimage_source_image_name}" # NB: must already exist in OpenStack
193-
image_name = "${source.name}-${local.timestamp}-${substr(local.git_commit, 0, 8)}" # similar to name from slurm_image_builder
166+
source_image = "${var.fatimage_source_image[var.os_version]}"
167+
source_image_name = "${var.fatimage_source_image_name[var.os_version]}" # NB: must already exist in OpenStack
168+
image_name = "${source.name}-${var.os_version}-${local.timestamp}-${substr(local.git_commit, 0, 8)}" # similar to name from slurm_image_builder
194169
}
195170

196171
provisioner "ansible" {

0 commit comments

Comments
 (0)