|
| 1 | +--- |
| 2 | +name: Build iPXE Images |
| 3 | + |
| 4 | +"on": |
| 5 | + # Allows you to run this workflow manually from the Actions tab |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + release_tag: |
| 9 | + description: 'Release tag (e.g., v1.0.0)' |
| 10 | + required: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-image: |
| 14 | + runs-on: ubuntu-22.04 |
| 15 | + |
| 16 | + # Permission needed to create a release and upload assets |
| 17 | + permissions: |
| 18 | + contents: write |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout Repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Install System Dependencies |
| 25 | + run: | |
| 26 | + echo "Installing system dependencies for iPXE build..." |
| 27 | + sudo apt-get update |
| 28 | + sudo apt-get install -y \ |
| 29 | + gcc \ |
| 30 | + make \ |
| 31 | + perl \ |
| 32 | + git \ |
| 33 | + libguestfs-tools |
| 34 | + echo "System dependencies installed" |
| 35 | +
|
| 36 | + - name: Build iPXE Images |
| 37 | + run: | |
| 38 | + echo "Building iPXE images using ipxe/Makefile..." |
| 39 | + cd ipxe |
| 40 | + make |
| 41 | + echo "iPXE images built successfully" |
| 42 | + ls -lh efi.img ipxe-boot-usb.raw |
| 43 | + cd .. |
| 44 | +
|
| 45 | + - name: Create Release Tag and Rename Images |
| 46 | + id: release_tag |
| 47 | + run: | |
| 48 | + RELEASE_TAG="${{ inputs.release_tag }}" |
| 49 | + echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT |
| 50 | + echo "Release tag: $RELEASE_TAG" |
| 51 | +
|
| 52 | + # Rename images to include the release tag |
| 53 | + TAGGED_EFI_IMAGE="ipxe-efi-${RELEASE_TAG}.img" |
| 54 | + TAGGED_BIOS_IMAGE="ipxe-bios-${RELEASE_TAG}.img" |
| 55 | +
|
| 56 | + cp ipxe/efi.img ${TAGGED_EFI_IMAGE} |
| 57 | + cp ipxe/ipxe-boot-usb.raw ${TAGGED_BIOS_IMAGE} |
| 58 | +
|
| 59 | + echo "tagged_efi_image=$TAGGED_EFI_IMAGE" >> $GITHUB_OUTPUT |
| 60 | + echo "tagged_bios_image=$TAGGED_BIOS_IMAGE" >> $GITHUB_OUTPUT |
| 61 | +
|
| 62 | + echo "Images renamed:" |
| 63 | + ls -lh ${TAGGED_EFI_IMAGE} ${TAGGED_BIOS_IMAGE} |
| 64 | +
|
| 65 | + # yamllint disable rule:line-length |
| 66 | + - name: Create Versioned GitHub Release |
| 67 | + uses: softprops/action-gh-release@v2 |
| 68 | + with: |
| 69 | + tag_name: ${{ steps.release_tag.outputs.release_tag }} |
| 70 | + name: "iPXE Images ${{ steps.release_tag.outputs.release_tag }}" |
| 71 | + body: | |
| 72 | + iPXE boot images built by GitHub Actions. |
| 73 | +
|
| 74 | + ## Images Included |
| 75 | +
|
| 76 | + - **ipxe-efi-${{ steps.release_tag.outputs.release_tag }}.img** - UEFI boot image |
| 77 | + - **ipxe-bios-${{ steps.release_tag.outputs.release_tag }}.img** - BIOS boot image (USB) |
| 78 | +
|
| 79 | + ## Usage |
| 80 | +
|
| 81 | + These images are used for network booting OpenShift nodes in HotStack scenarios. |
| 82 | +
|
| 83 | + ### Download |
| 84 | +
|
| 85 | + ```bash |
| 86 | + # Download UEFI boot image |
| 87 | + curl -L -O https://github.com/${{ github.repository }}/releases/download/${{ steps.release_tag.outputs.release_tag }}/ipxe-efi-${{ steps.release_tag.outputs.release_tag }}.img |
| 88 | +
|
| 89 | + # Download BIOS boot image |
| 90 | + curl -L -O https://github.com/${{ github.repository }}/releases/download/${{ steps.release_tag.outputs.release_tag }}/ipxe-bios-${{ steps.release_tag.outputs.release_tag }}.img |
| 91 | + ``` |
| 92 | +
|
| 93 | + ### Upload to Glance |
| 94 | +
|
| 95 | + See [iPXE README](https://github.com/${{ github.repository }}/blob/main/ipxe/README.md) for detailed upload instructions. |
| 96 | + files: | |
| 97 | + ${{ steps.release_tag.outputs.tagged_efi_image }} |
| 98 | + ${{ steps.release_tag.outputs.tagged_bios_image }} |
| 99 | + # yamllint enable rule:line-length |
| 100 | + |
| 101 | + - name: Update 'latest-ipxe' Release Tag |
| 102 | + uses: softprops/action-gh-release@v2 |
| 103 | + with: |
| 104 | + tag_name: latest-ipxe |
| 105 | + name: "iPXE Images (Latest)" |
| 106 | + prerelease: true |
| 107 | + body: | |
| 108 | + This is the latest iPXE images build. This release is automatically updated. |
| 109 | +
|
| 110 | + **Latest Build**: ${{ steps.release_tag.outputs.release_tag }} |
| 111 | +
|
| 112 | + ## Download |
| 113 | +
|
| 114 | + Use the static URLs for the latest build: |
| 115 | +
|
| 116 | + ```bash |
| 117 | + # Download UEFI boot image |
| 118 | + curl -L -O https://github.com/${{ github.repository }}/releases/download/latest-ipxe/ipxe-efi-latest.img |
| 119 | +
|
| 120 | + # Download BIOS boot image |
| 121 | + curl -L -O https://github.com/${{ github.repository }}/releases/download/latest-ipxe/ipxe-bios-latest.img |
| 122 | + ``` |
| 123 | +
|
| 124 | + ## Upload to Glance |
| 125 | +
|
| 126 | + Upload the BIOS boot image for OCP nodes: |
| 127 | +
|
| 128 | + ```bash |
| 129 | + openstack image create --disk-format=raw --file ipxe-bios-latest.img ipxe-boot-usb \ |
| 130 | + --property os_shutdown_timeout=5 \ |
| 131 | + --public |
| 132 | + ``` |
| 133 | +
|
| 134 | + Upload the UEFI rescue image: |
| 135 | +
|
| 136 | + ```bash |
| 137 | + openstack image create --disk-format=raw --file ipxe-efi-latest.img ipxe-rescue-uefi \ |
| 138 | + --property os_shutdown_timeout=5 \ |
| 139 | + --property hw_firmware_type=uefi \ |
| 140 | + --property hw_machine_type=q35 \ |
| 141 | + --public |
| 142 | + ``` |
| 143 | +
|
| 144 | + Upload the BIOS rescue image: |
| 145 | +
|
| 146 | + ```bash |
| 147 | + openstack image create --disk-format=raw --file ipxe-bios-latest.img ipxe-rescue-bios \ |
| 148 | + --property os_shutdown_timeout=5 \ |
| 149 | + --public |
| 150 | + ``` |
| 151 | +
|
| 152 | + For detailed documentation, see the [iPXE README](https://github.com/${{ github.repository }}/blob/main/ipxe/README.md). |
| 153 | + files: | |
| 154 | + ${{ steps.release_tag.outputs.tagged_efi_image }} |
| 155 | + ${{ steps.release_tag.outputs.tagged_bios_image }} |
| 156 | +
|
| 157 | + - name: Upload Images with Static Filenames to Latest Release |
| 158 | + run: | |
| 159 | + echo "Creating static filename copies for easy downloading..." |
| 160 | +
|
| 161 | + # Copy the images with static names |
| 162 | + cp ${{ steps.release_tag.outputs.tagged_efi_image }} ipxe-efi-latest.img |
| 163 | + cp ${{ steps.release_tag.outputs.tagged_bios_image }} ipxe-bios-latest.img |
| 164 | +
|
| 165 | + echo "Uploading to latest-ipxe release with static filenames..." |
| 166 | + # Upload to latest-ipxe release, replacing any existing files with the same names |
| 167 | + gh release upload latest-ipxe ipxe-efi-latest.img --clobber --repo ${{ github.repository }} |
| 168 | + gh release upload latest-ipxe ipxe-bios-latest.img --clobber --repo ${{ github.repository }} |
| 169 | +
|
| 170 | + echo "Static URLs available at:" |
| 171 | + echo "https://github.com/${{ github.repository }}/releases/download/latest-ipxe/ipxe-efi-latest.img" |
| 172 | + echo "https://github.com/${{ github.repository }}/releases/download/latest-ipxe/ipxe-bios-latest.img" |
| 173 | + env: |
| 174 | + GH_TOKEN: ${{ github.token }} |
0 commit comments