Support to build ARM64 Images targeting elxr12 and Ubuntu distros on Ubuntu ARM host platform #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Azure Linux Raw Image - ARM | |
| on: | |
| workflow_dispatch: # Manual runs | |
| inputs: | |
| ref: | |
| description: "Branch or SHA to test (e.g. feature/x or a1b2c3)" | |
| required: false | |
| run_qemu_test: | |
| description: "Run QEMU boot test after build" | |
| required: false | |
| default: "false" | |
| type: choice | |
| options: | |
| - "true" | |
| - "false" | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-azl3-arm-raw: | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Install Earthly | |
| uses: earthly/actions-setup@v1 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| version: "latest" | |
| - name: Install system deps | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y qemu-system-aarch64 ovmf tree jq systemd-ukify mmdebstrap systemd-boot qemu-efi-aarch64 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: stable | |
| - name: Prepare build script | |
| run: | | |
| if [ ! -f scripts/build_azl3_arm_raw.sh ]; then | |
| echo "scripts/build_azl3_arm_raw.sh not found!" | |
| exit 1 | |
| fi | |
| chmod +x scripts/build_azl3_arm_raw.sh | |
| - name: Run azl3 Raw Image Build | |
| env: | |
| #RUN_QEMU_TEST: ${{ github.event.push }} | |
| RUN_QEMU_TEST: false | |
| run: | | |
| echo "Starting azl3 raw image build..." | |
| # Ensure script has access to docker group for Earthly | |
| sudo usermod -aG docker $USER | |
| # Prepare arguments with input validation | |
| ARGS="" | |
| case "${RUN_QEMU_TEST}" in | |
| "true") | |
| ARGS="--qemu-test" | |
| echo "QEMU boot test will be run after build" | |
| ;; | |
| "false"|"") | |
| echo "QEMU boot test will be skipped" | |
| ;; | |
| *) | |
| echo "Invalid input for run_qemu_test: ${RUN_QEMU_TEST}" | |
| exit 1 | |
| ;; | |
| esac | |
| # Run the azl3 raw image build script | |
| ./scripts/build_azl3_arm_raw.sh $ARGS | |
| echo "azl3 raw image build completed." | |
| - name: Set file permissions for artifacts | |
| run: | | |
| sudo chmod -R 755 workspace/ || true | |
| find workspace/*/imagebuild/*/ -name "*.raw*" -exec chmod 777 {} \; || true | |
| - name: GitHub Upload Release Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: azl3-arm-raw-image | |
| path: | | |
| workspace/*/imagebuild/*/*.raw* | |
| retention-days: 30 |