From 4e0fc3861249b87e8266e42bf0184948f0b09a11 Mon Sep 17 00:00:00 2001 From: Dorian Date: Tue, 31 Mar 2026 23:43:32 +0100 Subject: [PATCH] feat: sequential build versioning, LND NET_RAW, status labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build versioning: - Sequential build counter (/opt/archipelago/build-counter) - Version format: 0.1.0-beta.N (written to build-info.txt) - Backend reads version from build-info.txt at startup, falls back to Cargo.toml version — no recompile needed - UI sidebar + settings show the build version automatically LND fix (belt + suspenders): - Added NET_RAW capability (config.rs, first-boot, container-specs) - Combined with tlsextraip=0.0.0.0 from previous commit Status labels: - Both "exited" AND "stopped" states with non-zero exit codes now show "crashed" in the UI Co-Authored-By: Claude Opus 4.6 (1M context) --- core/archipelago/src/data_model.rs | 19 +++++++++++++- image-recipe/build-auto-installer-iso.sh | 32 +++++++++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/core/archipelago/src/data_model.rs b/core/archipelago/src/data_model.rs index 84842143..2a49ff55 100644 --- a/core/archipelago/src/data_model.rs +++ b/core/archipelago/src/data_model.rs @@ -253,12 +253,29 @@ pub struct PatchOperation { } impl DataModel { + /// Read build version from /opt/archipelago/build-info.txt if available, + /// falling back to Cargo.toml version. This allows sequential CI build + /// numbers to be reflected in the UI without recompiling the binary. + fn detect_build_version() -> String { + if let Ok(content) = std::fs::read_to_string("/opt/archipelago/build-info.txt") { + for line in content.lines() { + if let Some(v) = line.strip_prefix("version=") { + let v = v.trim(); + if !v.is_empty() { + return v.to_string(); + } + } + } + } + env!("CARGO_PKG_VERSION").to_string() + } + /// Create a new empty data model with default values pub fn new() -> Self { Self { server_info: ServerInfo { id: uuid::Uuid::new_v4().to_string(), - version: env!("CARGO_PKG_VERSION").to_string(), + version: Self::detect_build_version(), name: Some("Archipelago".to_string()), pubkey: String::new(), status_info: StatusInfo { diff --git a/image-recipe/build-auto-installer-iso.sh b/image-recipe/build-auto-installer-iso.sh index 7fc47815..89347254 100755 --- a/image-recipe/build-auto-installer-iso.sh +++ b/image-recipe/build-auto-installer-iso.sh @@ -54,6 +54,21 @@ BUILD_FROM_SOURCE="${BUILD_FROM_SOURCE:-0}" UNBUNDLED="${UNBUNDLED:-0}" ARCH="${ARCH:-x86_64}" +# ── Sequential build numbering ───────────────────────────────────────── +# Increments on each build. Users see this in UI (Settings, sidebar). +# Counter persists in /opt/archipelago/build-counter (on build machine). +BUILD_COUNTER_FILE="/opt/archipelago/build-counter" +if [ -f "$BUILD_COUNTER_FILE" ]; then + BUILD_NUM=$(( $(cat "$BUILD_COUNTER_FILE") + 1 )) +else + BUILD_NUM=1 +fi +echo "$BUILD_NUM" | sudo tee "$BUILD_COUNTER_FILE" > /dev/null 2>/dev/null || BUILD_NUM=1 +GIT_SHORT=$(cd "$SCRIPT_DIR/.." && git rev-parse --short HEAD 2>/dev/null || echo "dev") +# Version format: 0.1.0-beta.BUILD_NUM (semver pre-release) +BUILD_VERSION="0.1.0-beta.${BUILD_NUM}" +echo "Build #${BUILD_NUM} (${BUILD_VERSION}, commit ${GIT_SHORT})" + # Architecture-dependent variables case "$ARCH" in x86_64|amd64) @@ -2178,6 +2193,14 @@ while true; do --disable-component-update \ --credentials_enable_service=false \ --disable-gpu \ + --disable-breakpad \ + --disable-metrics \ + --disable-metrics-reporting \ + --metrics-recording-only \ + --disable-domain-reliability \ + --disable-background-networking \ + --disable-background-timer-throttling \ + --disable-backgrounding-occluded-windows \ --user-data-dir=/home/archipelago/.config/chromium-kiosk sleep 3 done @@ -2652,7 +2675,9 @@ chroot /mnt/target systemctl enable archipelago-diag.service 2>/dev/null || true # Write build info into the installed system cat > /mnt/target/opt/archipelago/build-info.txt </dev/null && git -C "$BOOT_MEDIA/../" rev-parse --short HEAD 2>/dev/null || echo "unknown") +version=__BUILD_VERSION__ +build=__BUILD_NUM__ +commit=__GIT_SHORT__ date=$(date -u '+%Y-%m-%d %H:%M:%S UTC') type=unbundled BUILDINFO @@ -2736,6 +2761,11 @@ echo b > /proc/sysrq-trigger 2>/dev/null || \ kill -9 1 2>/dev/null INSTALLER_SCRIPT +# Inject build version into auto-install.sh (heredoc is single-quoted, can't expand variables) +sed -i "s|__BUILD_VERSION__|${BUILD_VERSION}|g" "$ARCH_DIR/auto-install.sh" +sed -i "s|__BUILD_NUM__|${BUILD_NUM}|g" "$ARCH_DIR/auto-install.sh" +sed -i "s|__GIT_SHORT__|${GIT_SHORT}|g" "$ARCH_DIR/auto-install.sh" + # For unbundled builds, patch the completion message to reflect no pre-loaded apps if [ "$UNBUNDLED" = "1" ]; then sed -i 's/Pre-loaded apps (ready to start via Web UI):/Install apps from the Marketplace (internet required):/' "$ARCH_DIR/auto-install.sh"