Skip to content

Commit c7e9eba

Browse files
committed
simplify build spec
1 parent fa16e2d commit c7e9eba

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

.github/workflows/nightlybuild.yml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,28 @@ jobs:
1717
openstack:
1818
name: openstack-imagebuild
1919
concurrency:
20-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.source_image.name }}-${{ matrix.inventory_groups.label }} # to branch/PR + OS + build
20+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.builds.label }}
2121
cancel-in-progress: true
2222
runs-on: ubuntu-22.04
2323
strategy:
2424
fail-fast: false # allow other matrix jobs to continue even if one fails
2525
matrix:
26-
source_image:
27-
- label: RL8
28-
name: Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2
29-
- label: RL9
30-
name: Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2
31-
inventory_groups:
32-
- label: ofed
33-
list: 'update,ofed'
34-
- label: cuda
35-
list: 'update,ofed,cuda'
36-
exclude:
37-
- source_image: {label: RL8}
38-
inventory_groups: {label: cuda}
26+
builds:
27+
- label: RL8-ofed
28+
source_image_name: Rocky-8-GenericCloud-Base-8.9-20231119.0.x86_64.qcow2
29+
inventory_groups: 'update,ofed'
30+
- label: RL9-ofed
31+
source_image_name: Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2
32+
inventory_groups: 'update,ofed'
33+
- label: RL9-cuda
34+
source_image_name: Rocky-9-GenericCloud-Base-9.4-20240523.0.x86_64.qcow2
35+
inventory_groups: 'update,ofed,cuda'
3936
env:
4037
ANSIBLE_FORCE_COLOR: True
4138
OS_CLOUD: openstack
4239
CI_CLOUD: ${{ github.event.inputs.ci_cloud || vars.CI_CLOUD }}
4340
# set the image suffix to -latest for cron jobs or a branch name if manually-triggered
44-
IMAGE_NAME_SUFFIX: ${{ github.event_name == 'schedule' && 'latest' || github.ref_name }}
41+
IMAGE_SUFFIX: ${{ github.event_name == 'schedule' && 'latest' || github.ref_name }}
4542

4643
steps:
4744
- uses: actions/checkout@v2
@@ -88,14 +85,13 @@ jobs:
8885
packer build \
8986
-on-error=${{ vars.PACKER_ON_ERROR }} \
9087
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
91-
-var source_image_name=${{ matrix.source_image.name }} \
92-
-var image_name=rocky-${{ matrix.source_image.label }}-${{ matrix.inventory_groups.label }} \
93-
-var image_name_suffix=${{ env.IMAGE_NAME_SUFFIX }} \
94-
-var inventory_groups=${{ matrix.inventory_groups.list }} \
88+
-var source_image_name=${{ matrix.builds.source_image_name }} \
89+
-var image_name=${{ matrix.builds.label }} \
90+
-var image_version=${{ env.IMAGE_SUFFIX }} \
91+
-var inventory_groups=${{ matrix.builds.inventory_groups }} \
9592
openstack.pkr.hcl
9693
env:
9794
PACKER_LOG: '1'
98-
9995

10096
- name: Get created image names from manifest
10197
id: manifest

packer/openstack.pkr.hcl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ data "git-commit" "cwd-head" { }
2323
locals {
2424
git_commit = data.git-commit.cwd-head.hash
2525
timestamp = formatdate("YYMMDD-hhmm", timestamp())
26-
image_name_suffix = var.image_name_suffix == "" ? "${local.timestamp}-${substr(local.git_commit, 0, 8)}" : var.image_name_suffix
26+
image_version = var.image_version == "" ? "${local.timestamp}-${substr(local.git_commit, 0, 8)}" : var.image_version
2727
}
2828

2929
# Path pointing to root of repository - automatically set by environment variable PKR_VAR_repo_root
@@ -140,7 +140,7 @@ variable "metadata" {
140140
variable "inventory_groups" {
141141
type = string
142142
description = "comma-separated list of inventory groups, in addition to 'builder'"
143-
default = ''
143+
default = ""
144144
}
145145

146146
# variable "groups" {
@@ -161,7 +161,7 @@ variable "image_name" {
161161
default = "openhpc"
162162
}
163163

164-
variable "image_name_suffix" {
164+
variable "image_version" {
165165
type = string
166166
description = "Suffix for built image names. If not supplied a timestamp+git commit is used"
167167
default = ""
@@ -202,7 +202,7 @@ build {
202202

203203
source "source.openstack.openhpc" {
204204
name = "rocky-latest"
205-
image_name = "${var.image_name}-${local.image_name_suffix}"
205+
image_name = "${var.image_name}-${local.image_version}"
206206
}
207207

208208
provisioner "ansible" {

0 commit comments

Comments
 (0)