Skip to content

Commit

Permalink
action: add -p option mkdir images
Browse files Browse the repository at this point in the history
This can cause the action to fail on a runner on which the /images
folder already exists.

Signed-off-by: Mahe Tardy <[email protected]>
  • Loading branch information
mtardy committed Apr 16, 2024
1 parent 31f007a commit 92a0a1c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: 'LVH image version'
required: true
default: '5.10-main'
images-folder:
description: 'Parent folder in which to put the downloaded images'
required: false
default: ''
lvh-version:
description: 'LVH cli version (Docker tag)'
required: true
Expand Down Expand Up @@ -140,7 +144,7 @@ runs:
if: ${{ inputs.provision == 'true' }}
id: cache-lvh-image
with:
path: /images/${{ inputs.image }}_${{ inputs.image-version }}.qcow2.zst
path: ${{ inputs.images_folder}}/images/${{ inputs.image }}_${{ inputs.image-version }}.qcow2.zst
key: lvh-image-${{ inputs.image }}_${{ inputs.image-version }}
- name: Derive VM image file name
if: ${{ inputs.provision == 'true' }}
Expand All @@ -151,9 +155,9 @@ runs:
if: ${{ inputs.provision == 'true' && steps.cache-lvh-image.outputs.cache-hit != 'true' }}
shell: bash
run: |
sudo mkdir /images; sudo chmod 777 /images
/bin/lvh images pull --cache quay.io/lvh-images/${{ inputs.image }}:${{ inputs.image-version }} --dir "/"
find /images
sudo mkdir -p ${{ inputs.images_folder }}/images; sudo chmod 777 ${{ inputs.images_folder }}/images
/bin/lvh images pull --cache quay.io/lvh-images/${{ inputs.image }}:${{ inputs.image-version }} --dir "${{ inputs.images_folder }}/"
find ${{ inputs.images_folder }}/images
- name: Start VM
if: ${{ inputs.provision == 'true' }}
shell: bash
Expand All @@ -169,7 +173,7 @@ runs:
extraArgs+=("-p" "${{ inputs.port-forward }}")
fi
sudo touch /tmp/console.log
sudo /bin/lvh run --host-mount=${{ inputs.host-mount }} --image /images/${{ steps.derive-image-name.outputs.image-name }}.qcow2 \
sudo /bin/lvh run --host-mount=${{ inputs.host-mount }} --image ${{ inputs.images_folder }}/images/${{ steps.derive-image-name.outputs.image-name }}.qcow2 \
--daemonize -p ${{ inputs.ssh-port }}:22 --serial-port ${{ inputs.serial-port }} \
--cpu=${{ inputs.cpu }} --mem=${{ inputs.mem }} --cpu-kind ${{ inputs.cpu-kind }} \
--console-log-file /tmp/console.log \
Expand Down

0 comments on commit 92a0a1c

Please sign in to comment.