-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
infra: Build also updates.img by comment
To do so: /build-image --updates.img
- Loading branch information
1 parent
678e3c9
commit 098a328
Showing
2 changed files
with
99 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,17 @@ | |
# THIS FILE IS GENERATED FROM A TEMPLATE | ||
# DO NOT EDIT THIS FILE MANUALLY! | ||
# ====================================== | ||
# The template is located in: build-iso.yml.j2 | ||
# The template is located in: build-image.yml.j2 | ||
|
||
# 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 | ||
# --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/[email protected] | ||
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-cd] | ||
needs: [pr-info, boot-iso, live-cd, 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-cd.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:" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
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-cd] | ||
needs: [pr-info, boot-iso, live-cd, 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-cd.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:" | ||
|