Skip to content

Commit 2fc3948

Browse files
authored
Merge pull request #389 from transt/PUC-535
feat: Add building ubuntu image
2 parents d5f6800 + 5bbd517 commit 2fc3948

File tree

5 files changed

+65
-32
lines changed

5 files changed

+65
-32
lines changed

.github/workflows/build-ironic-images.yaml

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,74 @@ on:
1515
types: [checks_requested]
1616

1717
jobs:
18-
build-ironic-images:
18+
discover:
1919
runs-on: ubuntu-latest
20+
outputs:
21+
yaml-files: ${{ steps.set-matrix.outputs.yaml-files }}
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
25+
26+
- name: Find YAML files
27+
id: set-matrix
28+
run: |
29+
yaml_files="[$(find . -maxdepth 1 -type f \( -name '*.yaml' -o -name '*.yml' \) -printf '"%f", ' | sed 's/, $//')]"
30+
echo "yaml-files=${yaml_files}" >> $GITHUB_OUTPUT
31+
working-directory: ironic-images
32+
33+
build:
34+
runs-on: ubuntu-latest
35+
needs: discover
2036
defaults:
2137
run:
22-
working-directory: ironic-images/ipa-debian-bookworm
38+
working-directory: ironic-images
39+
strategy:
40+
matrix:
41+
yaml-file: ${{ fromJson(needs.discover.outputs.yaml-files) }}
42+
2343
steps:
24-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
25-
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
44+
- name: Checkout repository
45+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
46+
47+
- name: Set up variables
48+
run: |
49+
echo "Processing YAML file: ${{ matrix.yaml-file }}"
50+
imagename=$(grep -m 1 '^- imagename:' "${{ matrix.yaml-file }}" | awk '{print $3}')
51+
echo "distro=${imagename%-*}" >> $GITHUB_ENV
52+
echo "release=${imagename##*-}" >> $GITHUB_ENV
53+
54+
- name: Setup python environment
55+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
2656
id: setup-python
2757
with:
2858
python-version: '3.11'
2959
cache: 'pip'
30-
- run: sudo apt update && sudo apt install -y debootstrap qemu-utils
31-
- run: pip install -r requirements.txt
32-
working-directory: ironic-images
33-
- name: Build the IPA image
34-
run: bash ipa-debian-bookworm.sh
60+
61+
- name: Install Dependencies
62+
run: sudo apt update && sudo apt install -y debootstrap qemu-utils squashfs-tools kpartx
63+
64+
- name: Install python packages
65+
run: pip install -r requirements.txt
66+
67+
- name: Build Images
68+
run: |
69+
diskimage-builder ${{ matrix.yaml-file }}
70+
mkdir -p upload
71+
find . -maxdepth 1 -type f \( -name '*.qcow2' -o -name '*.kernel' -o -name '*.initramfs' \) -exec cp {} upload/ \;
3572
env:
36-
ELEMENTS_PATH: ${{ env.pythonLocation }}/share/ironic-python-agent-builder/dib:${{ github.workspace }}/ironic-images/custom_elements
37-
- name: Dynamically set timestamp environment variable
38-
run: echo "TIMESTAMP=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_ENV
39-
- name: Publish IPA Release
73+
DIB_RELEASE: ${{ env.release }}
74+
ELEMENTS_PATH: "${{ env.distro == 'ipa-debian' && format('{0}/share/ironic-python-agent-builder/dib:{1}/ironic-images/custom_elements', env.pythonLocation, github.workspace) || ''}}"
75+
76+
- name: Set timestamp environment variable
77+
run: echo "TIMESTAMP=$(git show --no-patch --no-notes --pretty='%cd' --date=format:'%Y%m%d%H%M%S' ${{ github.sha }})" >> $GITHUB_ENV
78+
79+
- name: Publish Release
80+
id: create_release
4081
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2
4182
with:
42-
name: undercloud-ironic-ipa
43-
tag_name: undercloud-ironic-ipa-${{ env.TIMESTAMP }}
83+
name: understack-images
84+
tag_name: understack-images-${{ env.TIMESTAMP }}
4485
make_latest: true
4586
fail_on_unmatched_files: true
46-
files: |
47-
ironic-images/ipa-debian-bookworm/ipa-debian-bookworm.initramfs
48-
ironic-images/ipa-debian-bookworm/ipa-debian-bookworm.kernel
87+
files: ironic-images/upload/*
4988
if: ${{ github.ref == 'refs/heads/main' }}

ironic-images/ipa-debian-bookworm/README.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

ironic-images/ipa-debian-bookworm/ipa-debian-bookworm.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

ironic-images/ubuntu.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- imagename: ubuntu-noble
2+
elements:
3+
- ubuntu
4+
- grub2
5+
- block-device-efi
6+
- baremetal
7+
- bootloader
8+
- package-installs

0 commit comments

Comments
 (0)