krata: introduce nightly build

This commit is contained in:
Alex Zenla 2024-03-05 12:55:28 +00:00
parent 8653fd6249
commit a37f33e688
No known key found for this signature in database
GPG Key ID: 067B238899B51269
7 changed files with 48 additions and 37 deletions

18
.github/workflows/nightly.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: nightly
on:
schedule:
- cron: "0 4 * * *"
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: ./scripts/ci/install-deps.sh
- run: ./scripts/ci/nightly.sh
- uses: actions/upload-artifact@v4
with:
name: krata-nightly
path: krata.tgz
compression-level: 0

View File

@ -41,7 +41,6 @@ tar = "0.4.40"
zstd = "0.13.0"
termion = "3.0.0"
path-clean = "1.0.1"
ureq = "2.9.1"
url = "2.5.0"
cli-tables = "0.2.1"
rand = "0.8.5"

View File

@ -8,49 +8,17 @@ resolver = "2"
anyhow = { workspace = true }
log = { workspace = true }
env_logger = { workspace = true }
zstd = { workspace = true }
flate2 = { workspace = true }
tar = { workspace = true }
directories = { workspace = true }
walkdir = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
sha256 = { workspace = true }
url = { workspace = true }
ureq = { workspace = true }
reqwest = { workspace = true }
path-clean = { workspace = true }
termion = { workspace = true }
cli-tables = { workspace = true }
clap = { workspace = true }
oci-spec = { workspace = true }
backhand = { workspace = true }
uuid = { workspace = true }
ipnetwork = { workspace = true }
tokio = { workspace = true }
futures = { workspace = true }
bytes = { workspace = true }
tokio-stream = { workspace = true }
[dependencies.krata]
path = "../shared"
[dependencies.nix]
workspace = true
features = ["process"]
[dependencies.advmac]
path = "../libs/advmac"
[dependencies.loopdev]
path = "../libs/loopdev"
[dependencies.xenclient]
path = "../libs/xen/xenclient"
[dependencies.xenstore]
path = "../libs/xen/xenstore"
[lib]
path = "src/lib.rs"

View File

@ -17,7 +17,6 @@ serde = { workspace = true }
serde_json = { workspace = true }
sha256 = { workspace = true }
url = { workspace = true }
ureq = { workspace = true }
reqwest = { workspace = true }
path-clean = { workspace = true }
termion = { workspace = true }

View File

@ -5,12 +5,12 @@ TARGET="x86_64-unknown-linux-gnu"
export RUSTFLAGS="-Ctarget-feature=+crt-static"
cd "$(dirname "${0}")/.."
krata_DIR="${PWD}"
KRATA_DIR="${PWD}"
cargo build -q --bin krataguest --release --target "${TARGET}"
INITRD_DIR="$(mktemp -d /tmp/krata-initrd.XXXXXXXXXXXXX)"
cp "target/${TARGET}/release/krataguest" "${INITRD_DIR}/init"
chmod +x "${INITRD_DIR}/init"
cd "${INITRD_DIR}"
mkdir -p "${krata_DIR}/target/initrd"
find . | cpio -R 0:0 --reproducible -o -H newc --quiet > "${krata_DIR}/target/initrd/initrd"
mkdir -p "${KRATA_DIR}/initrd/target"
find . | cpio -R 0:0 --reproducible -o -H newc --quiet > "${KRATA_DIR}/initrd/target/initrd"
rm -rf "${INITRD_DIR}"

5
scripts/ci/install-deps.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
set -e
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev libelf-dev flex bison bc

22
scripts/ci/nightly.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
set -e
REAL_SCRIPT="$(realpath "${0}")"
cd "$(dirname "${REAL_SCRIPT}")/../.."
KRATA_DIR="${PWD}"
NIGHTLY_TAR="${KRATA_DIR}/krata.tgz"
NIGHTLY_DIR="$(mktemp -d /tmp/krata-release.XXXXXXXXXXXXX)"
for X in kratad kratanet kratactl
do
cargo build --release --target x86_64-unknown-linux-gnu --bin "${X}"
cp "${KRATA_DIR}/target/x86_64-unknown-linux-gnu/release/${X}" "${NIGHTLY_DIR}/${X}"
done
./initrd/build.sh
./kernel/build.sh
cd "${NIGHTLY_DIR}"
cp "${KRATA_DIR}/initrd/target/initrd" initrd
cp "${KRATA_DIR}/kernel/target/kernel" kernel
tar czf "${NIGHTLY_TAR}" .
cd "${KRATA_DIR}"
rm -rf "${NIGHTLY_DIR}"