workflows: upload os images on build

This commit is contained in:
Alex Zenla 2024-03-10 00:28:53 +00:00
parent 334d27a6a4
commit f1eedd1667
No known key found for this signature in database
GPG Key ID: 067B238899B51269
2 changed files with 20 additions and 8 deletions

View File

@ -3,9 +3,11 @@ on:
push:
paths:
- "os/**"
- "hack/os/**"
pull_request:
paths:
- "os/**"
- "hack/os/**"
jobs:
build:
name: build
@ -16,3 +18,9 @@ jobs:
- run: ./hack/os/build.sh
env:
KRATA_KERNEL_BUILD_JOBS: "5"
- uses: actions/upload-artifact@v4
with:
name: krata-os-x86_64
path: "target/os/krata.qcow2"
compression-level: 0

View File

@ -16,14 +16,18 @@ docker run --rm --privileged -v "${PWD}:/mnt" -it alpine:latest "/mnt/os/interna
sudo chown "${USER}:${GROUP}" "${TARGET_OS_DIR}/rootfs.tgz"
sudo modprobe nbd
NBD_DEVICE="$(find /dev -maxdepth 2 -name 'nbd[0-9]*' | while read -r DEVICE
do
next_nbd_device() {
find /dev -maxdepth 2 -name 'nbd[0-9]*' | while read -r DEVICE
do
if [ "$(sudo blockdev --getsize64 "${DEVICE}")" = "0" ]
then
echo "${DEVICE}"
break
fi
done)"
done
}
NBD_DEVICE="$(next_nbd_device)"
if [ -z "${NBD_DEVICE}" ]
then