Skip to content

Commit

Permalink
Generate temp paths for downloaded artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
acj committed Jan 7, 2024
1 parent d9b329a commit 8d46383
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,43 @@ runs:
path: firecracker-freebsd

- name: Download kernel
id: kernel
shell: bash
run: wget -q -O /tmp/freebsd-kern.bin ${{ inputs.kernel-url }}

run: |
path="$(mktemp)"
wget -q -O $path ${{ inputs.kernel-url }}
echo "path=$path" >> $GITHUB_OUTPUT
- name: Download rootfs artifact
id: rootfs
shell: bash
run: |
path="$(mktemp)"
wget -q -O /tmp/freebsd-rootfs.bin.xz ${{ inputs.rootfs-url }}
xz -T 0 -d /tmp/freebsd-rootfs.bin.xz
mv /tmp/freebsd-rootfs.bin $path
echo "path=$path" >> $GITHUB_OUTPUT
- name: Download firecracker binary
id: firecracker
shell: bash
run: |
wget -q -O /tmp/firecracker ${{ inputs.firecracker-url }}
chmod +x /tmp/firecracker
path="$(mktemp)"
wget -q -O $path ${{ inputs.firecracker-url }}
chmod +x $path
echo "path=$path" >> $GITHUB_OUTPUT
- name: Download and install SSH keypair
id: ssh-keypair
shell: sudo bash -e {0}
run: |
wget -q -O /tmp/freebsd.id_rsa.pub ${{ inputs.ssh-public-key-url }}
wget -q -O /tmp/freebsd.id_rsa ${{ inputs.ssh-private-key-url }}
chmod 600 /tmp/freebsd.id_rsa
install -D -m 700 -t /etc/ssh /tmp/freebsd.id_rsa
public_key_path="$(mktemp)"
private_key_path="/etc/ssh/freebsd.id_rsa"
wget -q -O $public_key_path ${{ inputs.ssh-public-key-url }}
wget -q -O $private_key_path ${{ inputs.ssh-private-key-url }}
chmod 600 $private_key_path
echo "public-key-path=$public_key_path" >> $GITHUB_OUTPUT
echo "private-key-path=$private_key_path" >> $GITHUB_OUTPUT
- name: Prepare ssh config
shell: sudo bash -e {0}
Expand All @@ -116,7 +131,7 @@ runs:
User root
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
IdentityFile /etc/ssh/freebsd.id_rsa
IdentityFile ${{ steps.ssh-keypair.outputs.public-key-path }}
EOF
- name: Print diagnostic info
Expand Down Expand Up @@ -164,9 +179,9 @@ runs:
API_SOCKET="/tmp/firecracker.socket"
LOGFILE="./firecracker.log"
KERNEL="/tmp/freebsd-kern.bin"
KERNEL="${{ steps.kernel.outputs.path }}"
KERNEL_BOOT_ARGS="vfs.root.mountfrom=ufs:/dev/vtbd0"
ROOTFS="/tmp/freebsd-rootfs.bin"
ROOTFS="${{ steps.rootfs.outputs.path }}"
# The IP address of a guest is derived from its MAC address with
# `fcnet-setup.sh`, this has been pre-configured in the guest rootfs. It is
Expand Down Expand Up @@ -205,9 +220,9 @@ runs:
EOF
if [ ${{ inputs.verbose }} = true ]; then
/tmp/firecracker --api-sock $API_SOCKET --config-file vmconfig.json --log-path $LOGFILE &
${{ steps.firecracker.outputs.path }} --api-sock $API_SOCKET --config-file vmconfig.json --log-path $LOGFILE &
else
/tmp/firecracker --api-sock $API_SOCKET --config-file vmconfig.json --log-path $LOGFILE > /dev/null 2>&1 &
${{ steps.firecracker.outputs.path }} --api-sock $API_SOCKET --config-file vmconfig.json --log-path $LOGFILE > /dev/null 2>&1 &
fi
firecracker_pid=$!
Expand Down

0 comments on commit 8d46383

Please sign in to comment.