|
| 1 | +name: Iso Builder Test Worfklow |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - './training/iso-builder/**' |
| 9 | + - '!training/iso-builder/README.md' |
| 10 | + - '.github/workflows/iso_builder_test.yaml' |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + paths: |
| 15 | + - './training/iso-builder/**' |
| 16 | + - '!training/iso-builder/README.md' |
| 17 | + - '.github/workflows/iso_builder_test.yaml' |
| 18 | + |
| 19 | + workflow_dispatch: |
| 20 | + |
| 21 | +env: |
| 22 | + REGISTRY: quay.io |
| 23 | + REGISTRY_ORG: ai-lab |
| 24 | + |
| 25 | +jobs: |
| 26 | + iso-builder-build-and-test: |
| 27 | + if: "!contains(github.event.pull_request.labels.*.name, 'hold-tests')" |
| 28 | + strategy: |
| 29 | + matrix: |
| 30 | + include: |
| 31 | + - platforms: linux/amd64,linux/arm64 |
| 32 | + parent_image_registry: quay.io |
| 33 | + parent_image_org: centos-bootc |
| 34 | + parent_image_name: centos-bootc |
| 35 | + parent_image_tag: stream9 |
| 36 | + iso_image_name: iso-builder-centos-bootc |
| 37 | + iso_download_url: https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/iso/CentOS-Stream-9-latest-x86_64-boot.iso |
| 38 | + iso_name: CentOS-Stream-9-latest-x86_64-boot.iso |
| 39 | + runs-on: ubuntu-22.04 |
| 40 | + permissions: |
| 41 | + contents: read |
| 42 | + packages: write |
| 43 | + steps: |
| 44 | + |
| 45 | + - name: Remove unnecessary files |
| 46 | + run: | |
| 47 | + sudo rm -rf /usr/share/dotnet |
| 48 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 49 | +
|
| 50 | + |
| 51 | + |
| 52 | + - name: Install qemu dependency |
| 53 | + run: | |
| 54 | + sudo apt-get update |
| 55 | + sudo apt-get install -y qemu-user-static |
| 56 | +
|
| 57 | + - name: Generate an SSH key |
| 58 | + id: ssh-keygen |
| 59 | + run: | |
| 60 | + ssh-keygen -t ed25519 -C "[email protected]" -N "" -f id_rsa |
| 61 | + echo "sshpubkey=$(cat id_rsa.pub | xargs)" >> $GITHUB_OUTPUT |
| 62 | +
|
| 63 | + - name: Download the ISO |
| 64 | + working-directory: ./training/iso-builder/ |
| 65 | + run: | |
| 66 | + make centos-iso-download |
| 67 | +
|
| 68 | + - name: Build Image |
| 69 | + id: build_image |
| 70 | + working-directory: ./training/iso-builder/ |
| 71 | + run: | |
| 72 | + make image FROM=${{ matrix.parent_image_registry }}/${{ matrix.parent_image_org }}/${{ matrix.parent_image_name }}:${{ matrix.parent_image_tag }} IMAGE_NAME=${{ matrix.iso_image_name }} IMAGE_TAG=${{ matrix.parent_image_tag }} |
| 73 | + echo "embedded_image=$(echo '${{ matrix.parent_image_registry }}/${{ matrix.parent_image_org }}/${{ matrix.parent_image_name }}:${{ matrix.parent_image_tag }}' | xargs)" >> $GITHUB_OUTPUT |
| 74 | + echo "produced_image=$(echo '${{env.REGISTRY}}/${{env.REGISTRY_ORG}}/${{ matrix.iso_image_name }}:${{ matrix.parent_image_tag }}' | xargs)" >> $GITHUB_OUTPUT |
| 75 | +
|
| 76 | + - name: Run the Image |
| 77 | + working-directory: ./training/iso-builder/ |
| 78 | + run: | |
| 79 | + make iso IMAGE=${{ steps.build_image.outputs.produced_image }} EMBED_IMAGE=${{ steps.build_image.outputs.embedded_image }} ORIGINAL_ISO="ISOs/${{ matrix.iso_name }}" SSHKEY="${{ steps.ssh-keygen.outputs.sshpubkey }}" CONTAINER_TOOL_EXTRA_ARGS=--pull=never |
| 80 | +
|
| 81 | + # - name: Setup tmate session |
| 82 | + # if: ${{ failure() }} |
| 83 | + # uses: mxschmitt/[email protected] |
| 84 | + # timeout-minutes: 10 |
| 85 | + # with: |
| 86 | + # detached: false |
| 87 | + # limit-access-to-actor: true |
| 88 | + |
| 89 | + # - name: Publish Job Results to Slack |
| 90 | + # id: slack |
| 91 | + # if: always() |
| 92 | + # uses: slackapi/[email protected] |
| 93 | + # with: |
| 94 | + # payload: | |
| 95 | + # { |
| 96 | + # "text": "${{ github.workflow }} workflow status: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
| 97 | + # } |
| 98 | + # env: |
| 99 | + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
0 commit comments