|
15 | 15 | types: [checks_requested] |
16 | 16 |
|
17 | 17 | jobs: |
18 | | - build-ironic-images: |
| 18 | + discover: |
19 | 19 | 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 |
20 | 36 | defaults: |
21 | 37 | 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 | + |
23 | 43 | 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 |
26 | 56 | id: setup-python |
27 | 57 | with: |
28 | 58 | python-version: '3.11' |
29 | 59 | 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/ \; |
35 | 72 | 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 |
40 | 81 | uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2 |
41 | 82 | 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 }} |
44 | 85 | make_latest: true |
45 | 86 | 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/* |
49 | 88 | if: ${{ github.ref == 'refs/heads/main' }} |
0 commit comments