Skip to content

Commit

Permalink
infra: Name built images sensibly
Browse files Browse the repository at this point in the history
Instead of boot.iso, name the images according to what they are built from:
- pr<#>-<hash>-boot.iso
- master-<hash>-boot.iso

A similar scheme is used for the artifact zip names.
  • Loading branch information
VladimirSlavik committed Jul 31, 2023
1 parent be24ef2 commit 9dc6ea4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/build-boot-iso.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ jobs:
echo "arguments are: $ARGS"
echo "args=${ARGS}" >> $GITHUB_OUTPUT
- name: Construct image description
id: image_description
run: |
set -eux
if [ "${{ github.event_name }}" = "workflow_dispatch" ] ; then
# manual run from actions page
branch_name="$GITHUB_REF_NAME"
sha="$GITHUB_SHA"
echo "image_description=$branch_name-$sha" >> $GITHUB_OUTPUT
else
# comment on PR
pr_num="${{ github.event.issue.number }}"
sha="${{ steps.pr_api.outcome == 'success' && fromJson(steps.pr_api.outputs.data).head.sha }}"
echo "image_description=pr$pr_num-$sha" >> $GITHUB_OUTPUT
fi
- name: Set outputs
id: set_outputs
run: |
Expand All @@ -80,6 +96,7 @@ jobs:
allowed_user: ${{ steps.set_outputs.outputs.allowed_user }}
sha: ${{ steps.set_outputs.outputs.sha }}
args: ${{ steps.parse_args.outputs.args }}
image_description: ${{ steps.image_description.outputs.image_description }}

run:
needs: pr-info
Expand Down Expand Up @@ -140,6 +157,7 @@ jobs:
-v `pwd`/images:/images:z \
$WEBUI_OPTIONAL_ARG \
$ISO_BUILD_CONTAINER_NAME:$CONTAINER_TAG
mv images/boot.iso "images/${{ needs.pr-info.outputs.image_description }}-boot.iso"
- name: Collect logs
if: always()
Expand All @@ -149,12 +167,12 @@ jobs:
path: |
images/*.log
- name: Upload image artifacts
- name: Upload image
uses: actions/upload-artifact@v3
with:
name: images
name: image ${{ needs.pr-info.outputs.image_description }}
path: |
images/boot.iso
images/*.iso
- name: Set result status
if: always()
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/build-boot-iso.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ jobs:
echo "arguments are: $ARGS"
echo "args=${ARGS}" >> $GITHUB_OUTPUT

- name: Construct image description
id: image_description
run: |
set -eux
if [ "${{ github.event_name }}" = "workflow_dispatch" ] ; then
# manual run from actions page
branch_name="$GITHUB_REF_NAME"
sha="$GITHUB_SHA"
echo "image_description=$branch_name-$sha" >> $GITHUB_OUTPUT
else
# comment on PR
pr_num="${{ github.event.issue.number }}"
sha="${{ steps.pr_api.outcome == 'success' && fromJson(steps.pr_api.outputs.data).head.sha }}"
echo "image_description=pr$pr_num-$sha" >> $GITHUB_OUTPUT
fi

- name: Set outputs
id: set_outputs
run: |
Expand All @@ -74,6 +90,7 @@ jobs:
allowed_user: ${{ steps.set_outputs.outputs.allowed_user }}
sha: ${{ steps.set_outputs.outputs.sha }}
args: ${{ steps.parse_args.outputs.args }}
image_description: ${{ steps.image_description.outputs.image_description }}

run:
needs: pr-info
Expand Down Expand Up @@ -134,6 +151,7 @@ jobs:
-v `pwd`/images:/images:z \
$WEBUI_OPTIONAL_ARG \
$ISO_BUILD_CONTAINER_NAME:$CONTAINER_TAG
mv images/boot.iso "images/${{ needs.pr-info.outputs.image_description }}-boot.iso"

- name: Collect logs
if: always()
Expand All @@ -143,12 +161,12 @@ jobs:
path: |
images/*.log

- name: Upload image artifacts
- name: Upload image
uses: actions/upload-artifact@v3
with:
name: images
name: image ${{ needs.pr-info.outputs.image_description }}
path: |
images/boot.iso
images/*.iso

- name: Set result status
if: always()
Expand Down

0 comments on commit 9dc6ea4

Please sign in to comment.