From 415a410bade419154d7f64804bb42edb8bd377a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Sl=C3=A1vik?= Date: Wed, 26 Jul 2023 19:07:12 +0200 Subject: [PATCH 1/3] infra: Build also live images Now run it from comment as: /build-image [--boot.iso] [--live] [--webui] --- .../{build-boot-iso.yml => build-image.yml} | 113 ++++++++++++++++-- ...ild-boot-iso.yml.j2 => build-image.yml.j2} | 111 +++++++++++++++-- 2 files changed, 205 insertions(+), 19 deletions(-) rename .github/workflows/{build-boot-iso.yml => build-image.yml} (67%) rename .github/workflows/{build-boot-iso.yml.j2 => build-image.yml.j2} (67%) diff --git a/.github/workflows/build-boot-iso.yml b/.github/workflows/build-image.yml similarity index 67% rename from .github/workflows/build-boot-iso.yml rename to .github/workflows/build-image.yml index 22dc3556dac..3477111fae8 100644 --- a/.github/workflows/build-boot-iso.yml +++ b/.github/workflows/build-image.yml @@ -3,12 +3,21 @@ # THIS FILE IS GENERATED FROM A TEMPLATE # DO NOT EDIT THIS FILE MANUALLY! # ====================================== -# The template is located in: build-boot-iso.yml.j2 +# The template is located in: build-image.yml.j2 -# Build a boot.iso from a PR triggered by a "/boot-iso" comment or manually. -# You can use the --webui option to build a webui boot.iso instead +# Build a bootable image from a PR triggered by a "/build-image" comment or manually. +# +# Choose type of the image with these options: +# --boot.iso +# --live +# +# If none of these is present, --boot-iso is assumed. +# If both are present, both variants are built. +# +# To use webui on boot.iso, add also: +# --webui -name: Build boot.iso +name: Build images on: issue_comment: types: [created] @@ -22,7 +31,7 @@ permissions: jobs: pr-info: - if: github.event_name == 'workflow_dispatch' || startsWith(github.event.comment.body, '/boot-iso') + if: github.event_name == 'workflow_dispatch' || startsWith(github.event.comment.body, '/build-image') runs-on: ubuntu-latest steps: - name: Query comment author repository permissions @@ -59,9 +68,13 @@ jobs: env: BODY: ${{ github.event.comment.body }} run: | - # extract first line and cut out the "/boot-iso" first word + # extract first line and cut out the "/build-image" first word ARGS=$(echo "$BODY" | sed -n '1 s/^[^ ]* *//p' | sed 's/[[:space:]]*$//') echo "arguments are: $ARGS" + if ! [[ "$ARGS" == *"--boot.iso"* || "$ARGS" == *"--live"* ]] ; then + ARGS="$ARGS --boot.iso" + echo "adding implicit --boot.iso, arguments now are: $ARGS" + fi echo "args=${ARGS}" >> $GITHUB_OUTPUT - name: Construct image description @@ -112,10 +125,10 @@ jobs: args: ${{ steps.parse_args.outputs.args }} image_description: ${{ steps.image_description.outputs.image_description }} - run: + boot-iso: needs: pr-info # only do this for Fedora for now; once we have RHEL 8/9 boot.iso builds working, also support these - if: needs.pr-info.outputs.allowed_user == 'true' + if: needs.pr-info.outputs.allowed_user == 'true' && contains(needs.pr-info.outputs.args, '--boot.iso') runs-on: [self-hosted, kstest] timeout-minutes: 300 env: @@ -158,7 +171,7 @@ jobs: mkdir -p ./anaconda_rpms/ cp -av ./result/build/01-rpm-build/*.rpm ./anaconda_rpms/ - - name: Build the boot.iso + - name: Build the ISO image run: | mkdir -p images if [[ "${{ needs.pr-info.outputs.args }}" == *"--webui"* ]] ; then @@ -184,7 +197,7 @@ jobs: - name: Upload image uses: actions/upload-artifact@v3 with: - name: image ${{ needs.pr-info.outputs.image_description }} + name: boot.iso image for ${{ needs.pr-info.outputs.image_description }} path: | images/*.iso @@ -211,3 +224,83 @@ jobs: target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + live-iso: + needs: pr-info + if: needs.pr-info.outputs.allowed_user == 'true' && contains(needs.pr-info.outputs.args, '--live') + runs-on: [self-hosted, kstest] + timeout-minutes: 300 + env: + STATUS_NAME: live-iso + CONTAINER_TAG: 'lorax' + ISO_BUILD_CONTAINER_NAME: 'quay.io/rhinstaller/anaconda-live-iso-creator' + steps: + # we post statuses manually as this does not run from a pull_request event + # https://developer.github.com/v3/repos/statuses/#create-a-status + - name: Create in-progress status + uses: octokit/request-action@v2.x + with: + route: 'POST /repos/${{ github.repository }}/statuses/${{ needs.pr-info.outputs.sha }}' + context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.launch_args }}' + state: pending + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Clone repository + uses: actions/checkout@v3 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Build anaconda-rpm container (for RPM build) + run: | + # set static tag to avoid complications when looking what tag is used + make -f ./Makefile.am anaconda-rpm-build CI_TAG=$CONTAINER_TAG + + - name: Build Anaconda RPM files + run: | + # output of the build will be stored in ./result/build/01-rpm-build/*.rpm + make -f ./Makefile.am container-rpms-scratch CI_TAG=$CONTAINER_TAG + + - name: Build anaconda-live-iso-creator container image + run: | + # set static tag to avoid complications when looking what tag is used + make -f ./Makefile.am anaconda-live-iso-creator-build CI_TAG=$CONTAINER_TAG + + - name: Build the ISO image + run: | + mkdir -p images + make -f Makefile.am container-live-iso-build CI_TAG=$CONTAINER_TAG + mv result/iso/Fedora-Workstation.iso "images/${{ needs.pr-info.outputs.image_description }}-Fedora-Workstation.iso" + + - name: Make artefacts created by sudo cleanable + if: always() + run: + sudo chown -R github:github . + + - name: Collect logs + if: always() + uses: actions/upload-artifact@v3 + with: + name: 'logs' + path: | + images/*.log + + - name: Upload image artifacts + uses: actions/upload-artifact@v3 + with: + name: live image for ${{ needs.pr-info.outputs.image_description }} + path: | + images/*.iso + + - name: Set result status + if: always() + uses: octokit/request-action@v2.x + with: + route: 'POST /repos/${{ github.repository }}/statuses/${{ needs.pr-info.outputs.sha }}' + context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.launch_args }}' + state: ${{ job.status }} + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build-boot-iso.yml.j2 b/.github/workflows/build-image.yml.j2 similarity index 67% rename from .github/workflows/build-boot-iso.yml.j2 rename to .github/workflows/build-image.yml.j2 index b0f8f99f76a..9c6108c12ef 100644 --- a/.github/workflows/build-boot-iso.yml.j2 +++ b/.github/workflows/build-image.yml.j2 @@ -1,8 +1,17 @@ {% if distro_release == "rawhide" %} -# Build a boot.iso from a PR triggered by a "/boot-iso" comment or manually. -# You can use the --webui option to build a webui boot.iso instead +# Build a bootable image from a PR triggered by a "/build-image" comment or manually. +# +# Choose type of the image with these options: +# --boot.iso +# --live +# +# If none of these is present, --boot-iso is assumed. +# If both are present, both variants are built. +# +# To use webui on boot.iso, add also: +# --webui -name: Build boot.iso +name: Build images on: issue_comment: types: [created] @@ -16,7 +25,7 @@ permissions: jobs: pr-info: - if: github.event_name == 'workflow_dispatch' || startsWith(github.event.comment.body, '/boot-iso') + if: github.event_name == 'workflow_dispatch' || startsWith(github.event.comment.body, '/build-image') runs-on: ubuntu-latest steps: - name: Query comment author repository permissions @@ -53,9 +62,13 @@ jobs: env: BODY: ${{ github.event.comment.body }} run: | - # extract first line and cut out the "/boot-iso" first word + # extract first line and cut out the "/build-image" first word ARGS=$(echo "$BODY" | sed -n '1 s/^[^ ]* *//p' | sed 's/[[:space:]]*$//') echo "arguments are: $ARGS" + if ! [[ "$ARGS" == *"--boot.iso"* || "$ARGS" == *"--live"* ]] ; then + ARGS="$ARGS --boot.iso" + echo "adding implicit --boot.iso, arguments now are: $ARGS" + fi echo "args=${ARGS}" >> $GITHUB_OUTPUT - name: Construct image description @@ -106,10 +119,10 @@ jobs: args: ${{ steps.parse_args.outputs.args }} image_description: ${{ steps.image_description.outputs.image_description }} - run: + boot-iso: needs: pr-info # only do this for Fedora for now; once we have RHEL 8/9 boot.iso builds working, also support these - if: needs.pr-info.outputs.allowed_user == 'true' + if: needs.pr-info.outputs.allowed_user == 'true' && contains(needs.pr-info.outputs.args, '--boot.iso') runs-on: [self-hosted, kstest] timeout-minutes: 300 env: @@ -152,7 +165,7 @@ jobs: mkdir -p ./anaconda_rpms/ cp -av ./result/build/01-rpm-build/*.rpm ./anaconda_rpms/ - - name: Build the boot.iso + - name: Build the ISO image run: | mkdir -p images if [[ "${{ needs.pr-info.outputs.args }}" == *"--webui"* ]] ; then @@ -178,7 +191,7 @@ jobs: - name: Upload image uses: actions/upload-artifact@v3 with: - name: image ${{ needs.pr-info.outputs.image_description }} + name: boot.iso image for ${{ needs.pr-info.outputs.image_description }} path: | images/*.iso @@ -205,4 +218,84 @@ jobs: target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + live-iso: + needs: pr-info + if: needs.pr-info.outputs.allowed_user == 'true' && contains(needs.pr-info.outputs.args, '--live') + runs-on: [self-hosted, kstest] + timeout-minutes: 300 + env: + STATUS_NAME: live-iso + CONTAINER_TAG: 'lorax' + ISO_BUILD_CONTAINER_NAME: 'quay.io/rhinstaller/anaconda-live-iso-creator' + steps: + # we post statuses manually as this does not run from a pull_request event + # https://developer.github.com/v3/repos/statuses/#create-a-status + - name: Create in-progress status + uses: octokit/request-action@v2.x + with: + route: 'POST /repos/${{ github.repository }}/statuses/${{ needs.pr-info.outputs.sha }}' + context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.launch_args }}' + state: pending + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Clone repository + uses: actions/checkout@v3 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Build anaconda-rpm container (for RPM build) + run: | + # set static tag to avoid complications when looking what tag is used + make -f ./Makefile.am anaconda-rpm-build CI_TAG=$CONTAINER_TAG + + - name: Build Anaconda RPM files + run: | + # output of the build will be stored in ./result/build/01-rpm-build/*.rpm + make -f ./Makefile.am container-rpms-scratch CI_TAG=$CONTAINER_TAG + + - name: Build anaconda-live-iso-creator container image + run: | + # set static tag to avoid complications when looking what tag is used + make -f ./Makefile.am anaconda-live-iso-creator-build CI_TAG=$CONTAINER_TAG + + - name: Build the ISO image + run: | + mkdir -p images + make -f Makefile.am container-live-iso-build CI_TAG=$CONTAINER_TAG + mv result/iso/Fedora-Workstation.iso "images/${{ needs.pr-info.outputs.image_description }}-Fedora-Workstation.iso" + + - name: Make artefacts created by sudo cleanable + if: always() + run: + sudo chown -R github:github . + + - name: Collect logs + if: always() + uses: actions/upload-artifact@v3 + with: + name: 'logs' + path: | + images/*.log + + - name: Upload image artifacts + uses: actions/upload-artifact@v3 + with: + name: live image for ${{ needs.pr-info.outputs.image_description }} + path: | + images/*.iso + + - name: Set result status + if: always() + uses: octokit/request-action@v2.x + with: + route: 'POST /repos/${{ github.repository }}/statuses/${{ needs.pr-info.outputs.sha }}' + context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.launch_args }}' + state: ${{ job.status }} + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} {% endif %} From afd8b02b0122bf526912cd40e9889cfff024deb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Sl=C3=A1vik?= Date: Thu, 24 Aug 2023 17:37:23 +0200 Subject: [PATCH 2/3] infra: Comment about images built when all is done --- .github/workflows/build-image.yml | 53 +++++++++++++++++++++------- .github/workflows/build-image.yml.j2 | 53 +++++++++++++++++++++------- 2 files changed, 80 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 3477111fae8..368bb689982 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -201,19 +201,6 @@ jobs: path: | images/*.iso - - name: Add comment with link to PR - if: github.event_name != 'workflow_dispatch' - env: - GH_TOKEN: ${{ github.token }} - run: | - sha="${{ needs.pr-info.outputs.sha }}" - url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - echo -n "\`boot.iso\` built successfully based on commit $sha. " >> comment.txt - echo -e "Download it from the bottom of the [job status page]($url).\n" >> comment.txt - echo "Comment to be posted:" - cat comment.txt - gh pr comment ${{ github.event.issue.number }} -F comment.txt - - name: Set result status if: always() uses: octokit/request-action@v2.x @@ -304,3 +291,43 @@ jobs: target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + finalize: + needs: [pr-info, boot-iso, live-iso] + runs-on: ubuntu-latest + # needs always() to run even if builds failed + if: ${{ always() && !cancelled() && github.event_name != 'workflow_dispatch' && needs.pr-info.outputs.allowed_user == 'true' }} + steps: + + - name: Clone repository + # need the repo to successfully post a comment :-/ + uses: actions/checkout@v3 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 1 + + - name: Add comment with link to PR + env: + GH_TOKEN: ${{ github.token }} + run: | + sha="${{ needs.pr-info.outputs.sha }}" + url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts" + + echo -e -n "Images built based on commit $sha:\n" > comment.txt + if [[ "${{ needs.pr-info.outputs.args }}" == *"--boot.iso"* ]] ; then + # .result can be success, failure, cancelled, or skipped + # https://docs.github.com/en/actions/learn-github-actions/contexts#jobs-context + echo -e "- \`boot.iso\`: ${{ needs.boot-iso.result }}\n" >> comment.txt + fi + if [[ "${{ needs.pr-info.outputs.args }}" == *"--live"* ]] ; then + echo -e "- Live: ${{ needs.live-iso.result }}\n" >> comment.txt + fi + echo -e "\nDownload the images from the bottom of the [job status page]($url).\n" >> comment.txt + + echo "Comment to be posted:" + cat comment.txt + + gh pr comment \ + ${{ github.event.issue.number }} \ + -F comment.txt diff --git a/.github/workflows/build-image.yml.j2 b/.github/workflows/build-image.yml.j2 index 9c6108c12ef..00316b51b15 100644 --- a/.github/workflows/build-image.yml.j2 +++ b/.github/workflows/build-image.yml.j2 @@ -195,19 +195,6 @@ jobs: path: | images/*.iso - - name: Add comment with link to PR - if: github.event_name != 'workflow_dispatch' - env: - GH_TOKEN: ${{ github.token }} - run: | - sha="${{ needs.pr-info.outputs.sha }}" - url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - echo -n "\`boot.iso\` built successfully based on commit $sha. " >> comment.txt - echo -e "Download it from the bottom of the [job status page]($url).\n" >> comment.txt - echo "Comment to be posted:" - cat comment.txt - gh pr comment ${{ github.event.issue.number }} -F comment.txt - - name: Set result status if: always() uses: octokit/request-action@v2.x @@ -298,4 +285,44 @@ jobs: target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + + finalize: + needs: [pr-info, boot-iso, live-iso] + runs-on: ubuntu-latest + # needs always() to run even if builds failed + if: ${{ always() && !cancelled() && github.event_name != 'workflow_dispatch' && needs.pr-info.outputs.allowed_user == 'true' }} + steps: + + - name: Clone repository + # need the repo to successfully post a comment :-/ + uses: actions/checkout@v3 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 1 + + - name: Add comment with link to PR + env: + GH_TOKEN: ${{ github.token }} + run: | + sha="${{ needs.pr-info.outputs.sha }}" + url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts" + + echo -e -n "Images built based on commit $sha:\n" > comment.txt + if [[ "${{ needs.pr-info.outputs.args }}" == *"--boot.iso"* ]] ; then + # .result can be success, failure, cancelled, or skipped + # https://docs.github.com/en/actions/learn-github-actions/contexts#jobs-context + echo -e "- \`boot.iso\`: ${{ needs.boot-iso.result }}\n" >> comment.txt + fi + if [[ "${{ needs.pr-info.outputs.args }}" == *"--live"* ]] ; then + echo -e "- Live: ${{ needs.live-iso.result }}\n" >> comment.txt + fi + echo -e "\nDownload the images from the bottom of the [job status page]($url).\n" >> comment.txt + + echo "Comment to be posted:" + cat comment.txt + + gh pr comment \ + ${{ github.event.issue.number }} \ + -F comment.txt {% endif %} From 2dc39033ce27ca3dcb92ac57654ceb6934dbdad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Sl=C3=A1vik?= Date: Thu, 24 Aug 2023 19:02:58 +0200 Subject: [PATCH 3/3] infra: Build also updates.img by comment To do so: /build-image --updates.img --- .github/workflows/build-image.yml | 52 ++++++++++++++++++++++++++-- .github/workflows/build-image.yml.j2 | 52 ++++++++++++++++++++++++++-- 2 files changed, 98 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 368bb689982..80af6c68140 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -10,9 +10,10 @@ # Choose type of the image with these options: # --boot.iso # --live +# --updates.img # # If none of these is present, --boot-iso is assumed. -# If both are present, both variants are built. +# If more are present at once, all variants are built. # # To use webui on boot.iso, add also: # --webui @@ -71,7 +72,7 @@ jobs: # extract first line and cut out the "/build-image" first word ARGS=$(echo "$BODY" | sed -n '1 s/^[^ ]* *//p' | sed 's/[[:space:]]*$//') echo "arguments are: $ARGS" - if ! [[ "$ARGS" == *"--boot.iso"* || "$ARGS" == *"--live"* ]] ; then + if ! [[ "$ARGS" == *"--boot.iso"* || "$ARGS" == *"--live"* || "$ARGS" == *"--updates.img"* ]] ; then ARGS="$ARGS --boot.iso" echo "adding implicit --boot.iso, arguments now are: $ARGS" fi @@ -292,9 +293,51 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + updates-img: + needs: pr-info + if: needs.pr-info.outputs.allowed_user == 'true' && contains(needs.pr-info.outputs.args, '--updates.img') + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + STATUS_NAME: updates-img + steps: + - name: Clone repository + uses: actions/checkout@v3 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Install required packages + run: | + sudo apt install -y dracut + + - name: Create updates image + run: | + ./scripts/makeupdates + new_name="${{ needs.pr-info.outputs.image_description }}-updates.img" + mv updates.img "$new_name" + lsinitrd "$new_name" + + - name: Upload image + uses: actions/upload-artifact@v3 + with: + name: updates.img for ${{ needs.pr-info.outputs.image_description }} + path: | + *.img + + - name: Set result status + if: always() + uses: octokit/request-action@v2.x + with: + route: 'POST /repos/${{ github.repository }}/statuses/${{ needs.pr-info.outputs.sha }}' + context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.launch_args }}' + state: ${{ job.status }} + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} finalize: - needs: [pr-info, boot-iso, live-iso] + needs: [pr-info, boot-iso, live-iso, updates-img] runs-on: ubuntu-latest # needs always() to run even if builds failed if: ${{ always() && !cancelled() && github.event_name != 'workflow_dispatch' && needs.pr-info.outputs.allowed_user == 'true' }} @@ -323,6 +366,9 @@ jobs: if [[ "${{ needs.pr-info.outputs.args }}" == *"--live"* ]] ; then echo -e "- Live: ${{ needs.live-iso.result }}\n" >> comment.txt fi + if [[ "${{ needs.pr-info.outputs.args }}" == *"--updates.img"* ]] ; then + echo -e "- \`updates.img\`: ${{ needs.updates-img.result }}\n" >> comment.txt + fi echo -e "\nDownload the images from the bottom of the [job status page]($url).\n" >> comment.txt echo "Comment to be posted:" diff --git a/.github/workflows/build-image.yml.j2 b/.github/workflows/build-image.yml.j2 index 00316b51b15..2622230ed0c 100644 --- a/.github/workflows/build-image.yml.j2 +++ b/.github/workflows/build-image.yml.j2 @@ -4,9 +4,10 @@ # Choose type of the image with these options: # --boot.iso # --live +# --updates.img # # If none of these is present, --boot-iso is assumed. -# If both are present, both variants are built. +# If more are present at once, all variants are built. # # To use webui on boot.iso, add also: # --webui @@ -65,7 +66,7 @@ jobs: # extract first line and cut out the "/build-image" first word ARGS=$(echo "$BODY" | sed -n '1 s/^[^ ]* *//p' | sed 's/[[:space:]]*$//') echo "arguments are: $ARGS" - if ! [[ "$ARGS" == *"--boot.iso"* || "$ARGS" == *"--live"* ]] ; then + if ! [[ "$ARGS" == *"--boot.iso"* || "$ARGS" == *"--live"* || "$ARGS" == *"--updates.img"* ]] ; then ARGS="$ARGS --boot.iso" echo "adding implicit --boot.iso, arguments now are: $ARGS" fi @@ -286,9 +287,51 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + updates-img: + needs: pr-info + if: needs.pr-info.outputs.allowed_user == 'true' && contains(needs.pr-info.outputs.args, '--updates.img') + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + STATUS_NAME: updates-img + steps: + - name: Clone repository + uses: actions/checkout@v3 + with: + ref: ${{ needs.pr-info.outputs.sha }} + fetch-depth: 0 + + - name: Install required packages + run: | + sudo apt install -y dracut + + - name: Create updates image + run: | + ./scripts/makeupdates + new_name="${{ needs.pr-info.outputs.image_description }}-updates.img" + mv updates.img "$new_name" + lsinitrd "$new_name" + + - name: Upload image + uses: actions/upload-artifact@v3 + with: + name: updates.img for ${{ needs.pr-info.outputs.image_description }} + path: | + *.img + + - name: Set result status + if: always() + uses: octokit/request-action@v2.x + with: + route: 'POST /repos/${{ github.repository }}/statuses/${{ needs.pr-info.outputs.sha }}' + context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.launch_args }}' + state: ${{ job.status }} + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} finalize: - needs: [pr-info, boot-iso, live-iso] + needs: [pr-info, boot-iso, live-iso, updates-img] runs-on: ubuntu-latest # needs always() to run even if builds failed if: ${{ always() && !cancelled() && github.event_name != 'workflow_dispatch' && needs.pr-info.outputs.allowed_user == 'true' }} @@ -317,6 +360,9 @@ jobs: if [[ "${{ needs.pr-info.outputs.args }}" == *"--live"* ]] ; then echo -e "- Live: ${{ needs.live-iso.result }}\n" >> comment.txt fi + if [[ "${{ needs.pr-info.outputs.args }}" == *"--updates.img"* ]] ; then + echo -e "- \`updates.img\`: ${{ needs.updates-img.result }}\n" >> comment.txt + fi echo -e "\nDownload the images from the bottom of the [job status page]($url).\n" >> comment.txt echo "Comment to be posted:"