Skip to content

Commit 1f393e3

Browse files
committed
update fatimage for new packer/flow
1 parent 9e717a9 commit 1f393e3

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

.github/workflows/fatimage.yml

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,20 @@ jobs:
2121
strategy:
2222
fail-fast: false # allow other matrix jobs to continue even if one fails
2323
matrix: # build RL8+OFED, RL9+OFED, RL9+OFED+CUDA versions
24-
os_version:
25-
- RL8
26-
- RL9
27-
build:
28-
- openstack.openhpc
29-
- openstack.openhpc-cuda
30-
exclude:
31-
- os_version: RL8
32-
build: openstack.openhpc-cuda
24+
builds:
25+
- label: openhpc-RL8-ofed
26+
source_image_name: RL8-ofed
27+
inventory_groups: 'control,login,compute'
28+
- label: openhpc-RL9-ofed
29+
source_image_name: RL9-ofed
30+
inventory_groups: 'control,login,compute'
31+
- label: openhpc-RL9-cuda
32+
source_image_name: RL9-cuda
33+
inventory_groups: 'control,login,compute'
3334
env:
3435
ANSIBLE_FORCE_COLOR: True
3536
OS_CLOUD: openstack
3637
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-
}
48-
4938
steps:
5039
- uses: actions/checkout@v2
5140

@@ -79,6 +68,20 @@ jobs:
7968
. venv/bin/activate
8069
. environments/.stackhpc/activate
8170
71+
- name: Select branch-specific or latest nightly image
72+
id: select_source_image
73+
run: |
74+
. venv/bin/activate
75+
. environments/.stackhpc/activate
76+
BRANCH=${{ github.ref_name }}
77+
BRANCH_VERSION=${BRANCH//\/-}
78+
NIGHTLY_IMAGE_ID=$( \
79+
openstack image show -c id -f value ${{ matrix.builds.source_image_name }}-${BRANCH_VERSION} || \
80+
openstack image show -c id -f value ${{ matrix.builds.source_image_name }}-latest \
81+
)
82+
echo selected source_image $NIGHTLY_IMAGE_ID: $(openstack image show -c name -f value $NIGHTLY_IMAGE_ID)
83+
echo "source_image_id=$NIGHTLY_IMAGE_ID" >> "$GITHUB_OUTPUT"
84+
8285
- name: Build fat image with packer
8386
id: packer_build
8487
run: |
@@ -88,15 +91,15 @@ jobs:
8891
cd packer/
8992
packer init .
9093
91-
PACKER_LOG=1 packer build \
94+
packer build \
9295
-on-error=${{ vars.PACKER_ON_ERROR }} \
93-
-only=${{ matrix.build }} \
9496
-var-file=$PKR_VAR_environment_root/${{ env.CI_CLOUD }}.pkrvars.hcl \
95-
-var "source_image_name=${{ env.SOURCE_IMAGE }}" \
97+
-var source_image=${{ steps.select_source_image.outputs.source_image_id }}
98+
-var image_name=${{ matrix.builds.label }} \
99+
-var inventory_groups=${{ matrix.builds.inventory_groups }} \
96100
openstack.pkr.hcl
97101
env:
98-
PKR_VAR_os_version: ${{ matrix.os_version }}
99-
SOURCE_IMAGE: ${{ fromJSON(env.SOURCE_IMAGES_MAP)[matrix.os_version][matrix.build] }}
102+
PACKER_LOG: '1'
100103

101104
- name: Get created image names from manifest
102105
id: manifest
@@ -113,7 +116,7 @@ jobs:
113116
- name: Upload manifest artifact
114117
uses: actions/upload-artifact@v4
115118
with:
116-
name: image-details-${{ matrix.build }}-${{ matrix.os_version }}
119+
name: image-details-${{ matrix.builds.label }}
117120
path: |
118121
./image-id.txt
119122
./image-name.txt

0 commit comments

Comments
 (0)