Skip to content

Commit 5583ed4

Browse files
committed
refactor(vm): source runtime pins only from pins.env
The VM runtime scripts sourced pins.env optionally and duplicated the LIBKRUN_REF and UMOCI_VERSION defaults, so every bump had to update the same value in several files. Require pins.env, drop the duplicated defaults, and fail on an invalid LIBKRUN_REF instead of silently building upstream HEAD. Environment overrides still take precedence through the defaults in pins.env. Signed-off-by: Florent Benoit <fbenoit@redhat.com>
1 parent 82bc756 commit 5583ed4

5 files changed

Lines changed: 12 additions & 25 deletions

File tree

‎tasks/scripts/vm/build-libkrun-macos.sh‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ set -euo pipefail
3333
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
3434

3535
# Source pinned dependency versions.
36-
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env" 2>/dev/null || true
36+
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env"
3737

3838
BUILD_DIR="${ROOT}/target/libkrun-build"
3939
OUTPUT_DIR="${BUILD_DIR}"
@@ -153,9 +153,6 @@ echo " Built: libkrunfw.${ABI_VERSION}.dylib ($(du -sh "${OUTPUT_DIR}/libkrun
153153

154154
# ── Clone libkrun ───────────────────────────────────────────────────────
155155

156-
# LIBKRUN_REF is sourced from pins.env; env-var override still works.
157-
LIBKRUN_REF="${LIBKRUN_REF:-227b2de6ed323fe180e02f871c5f325a90c13cc2}"
158-
159156
if [ ! -d libkrun ]; then
160157
echo "==> Cloning libkrun..."
161158
git clone https://github.com/libkrun/libkrun.git

‎tasks/scripts/vm/build-libkrun.sh‎

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ source "${SCRIPT_DIR}/_lib.sh"
2929
ROOT="$(vm_lib_root)"
3030

3131
# Source pinned dependency versions.
32-
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env" 2>/dev/null || true
32+
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env"
3333

3434
BUILD_DIR="${ROOT}/target/libkrun-build"
3535
OUTPUT_DIR="${BUILD_DIR}"
@@ -133,18 +133,16 @@ echo "==> Building libkrunfw with custom kernel config..."
133133
ensure_python3_with_pyelftools_for_libkrunfw
134134

135135
if [ ! -d libkrunfw ]; then
136-
echo " Cloning libkrunfw (pinned: ${LIBKRUNFW_REF:-HEAD})..."
136+
echo " Cloning libkrunfw (pinned: ${LIBKRUNFW_REF})..."
137137
git clone https://github.com/libkrun/libkrunfw.git
138138
fi
139139

140140
cd libkrunfw
141141

142142
# Ensure we're on the pinned commit for reproducible builds
143-
if [ -n "${LIBKRUNFW_REF:-}" ]; then
144-
echo " Checking out pinned ref: ${LIBKRUNFW_REF}"
145-
git fetch origin
146-
git checkout "${LIBKRUNFW_REF}"
147-
fi
143+
echo " Checking out pinned ref: ${LIBKRUNFW_REF}"
144+
git fetch origin
145+
git checkout "${LIBKRUNFW_REF}"
148146

149147
# Copy custom kernel config fragment
150148
if [ -f "$KERNEL_CONFIG" ]; then
@@ -415,21 +413,16 @@ echo "==> Building libkrun..."
415413
ensure_cargo_for_libkrun
416414
ensure_libclang_for_libkrun
417415

418-
# LIBKRUN_REF is sourced from pins.env (line 32); env-var override still works.
419-
LIBKRUN_REF="${LIBKRUN_REF:-227b2de6ed323fe180e02f871c5f325a90c13cc2}"
420-
421416
if [ ! -d libkrun ]; then
422417
echo " Cloning libkrun..."
423418
git clone https://github.com/libkrun/libkrun.git
424419
fi
425420

426421
cd libkrun
427422

428-
if [ -n "${LIBKRUN_REF:-}" ]; then
429-
echo " Checking out pinned ref: ${LIBKRUN_REF}"
430-
git fetch origin "${LIBKRUN_REF}" 2>/dev/null || git fetch origin
431-
git checkout "${LIBKRUN_REF}" 2>/dev/null || git checkout "origin/${LIBKRUN_REF}" 2>/dev/null || true
432-
fi
423+
echo " Checking out pinned ref: ${LIBKRUN_REF}"
424+
git fetch origin "${LIBKRUN_REF}" 2>/dev/null || git fetch origin
425+
git checkout "${LIBKRUN_REF}" 2>/dev/null || git checkout "origin/${LIBKRUN_REF}"
433426

434427
echo " Building libkrun with NET=1 BLK=1..."
435428
cargo build --release --features blk --features net --target-dir="$(pwd)/target"

‎tasks/scripts/vm/compress-vm-runtime.sh‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ source "${SCRIPT_DIR}/_lib.sh"
2727
ROOT="$(vm_lib_root)"
2828

2929
# Source pins for runtime tool versions.
30-
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env" 2>/dev/null || true
31-
UMOCI_VERSION="${UMOCI_VERSION:-v0.6.0}"
30+
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env"
3231

3332
# ── macOS dylib portability helpers ─────────────────────────────────────
3433

‎tasks/scripts/vm/download-kernel-runtime.sh‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ set -euo pipefail
2424
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2525
source "${SCRIPT_DIR}/_lib.sh"
2626
ROOT="$(vm_lib_root)"
27-
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env" 2>/dev/null || true
27+
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env"
2828

2929
RELEASE_TAG="${VM_RUNTIME_RELEASE_TAG:-vm-runtime}"
3030
REPO="${GITHUB_REPOSITORY:-NVIDIA/OpenShell}"
3131
OUTPUT_DIR="${OPENSHELL_VM_RUNTIME_COMPRESSED_DIR:-${ROOT}/target/vm-runtime-compressed}"
32-
UMOCI_VERSION="${UMOCI_VERSION:-v0.6.0}"
3332

3433
# ── Auto-detect platform (detect_platform from _lib.sh) ─────────────────
3534

‎tasks/scripts/vm/package-vm-runtime.sh‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ source "${SCRIPT_DIR}/_lib.sh"
3030
ROOT="$(vm_lib_root)"
3131

3232
# Source pins for runtime tool versions.
33-
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env" 2>/dev/null || true
34-
UMOCI_VERSION="${UMOCI_VERSION:-v0.6.0}"
33+
source "${ROOT}/crates/openshell-driver-vm/runtime/pins.env"
3534

3635
PLATFORM=""
3736
BUILD_DIR=""

0 commit comments

Comments
 (0)