Revert os-release path to /mnt/root

/mnt/boot/os-release isn't always accurate so /mnt/root should be the source of truth.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
This commit is contained in:
Christina Ying Wang 2023-10-09 12:47:22 -07:00
parent b096cb6328
commit bc1d251e66
5 changed files with 21 additions and 5 deletions

View File

@ -7,14 +7,15 @@ testfs:
# in the `testfs` configuration.
filesystem:
/mnt/boot:
os-release:
from: test/data/etc/os-release
config.json:
from: test/data/testconfig.json
config.txt:
from: test/data/mnt/boot/config.txt
device-type.json:
from: test/data/mnt/boot/device-type.json
/mnt/root/etc:
os-release:
from: test/data/etc/os-release
# The `keep` list defines files that already exist in the
# filesystem and need to be backed up before setting up the test environment
keep: []

View File

@ -81,7 +81,7 @@ services:
# Required to set mountpoints normally set in entry.sh
ROOT_MOUNTPOINT: /mnt/root
BOOT_MOUNTPOINT: /mnt/boot
HOST_OS_VERSION_PATH: /mnt/boot/os-release
HOST_OS_VERSION_PATH: /mnt/root/etc/os-release
STATE_MOUNTPOINT: /mnt/state
DATA_MOUNTPOINT: /mnt/data
DATABASE_PATH: /data/database.sqlite

View File

@ -103,7 +103,11 @@ setup_then_mount "boot" "${BOOT_MOUNTPOINT}"
export BOOT_MOUNTPOINT
# Read from the os-release of boot partition instead of overlay
export HOST_OS_VERSION_PATH="${BOOT_MOUNTPOINT}/os-release"
#
# TODO: We need to remove the dependence on /mnt/root for this particular file.
# Reading from /mnt/boot/os-release is not always accurate, so we need to work
# with the OS team to find a better way to get the OS version.
export HOST_OS_VERSION_PATH="/mnt/root/etc/os-release"
# CONFIG_MOUNT_POINT is set to /boot/config.json in Dockerfile.template,
# but that's a legacy mount provided by host and we should override it.

View File

@ -0,0 +1,11 @@
ID="balena-os"
NAME="balenaOS"
VERSION="4.0.11+rev1"
VERSION_ID="4.0.11+rev1"
PRETTY_NAME="balenaOS 4.0.11+rev1"
DISTRO_CODENAME="kirkstone"
MACHINE="genericx86-64"
META_BALENA_VERSION="4.0.11"
BALENA_BOARD_REV="9c804eb"
META_BALENA_REV="2afff0f8"
SLUG="intel-nuc"

View File

@ -425,7 +425,7 @@ describe('manages application lifecycle', () => {
// Versions match semver versioning scheme: major.minor.patch(+rev)?
expect(body)
.to.have.property('os_version')
.that.matches(/balenaOS\s[1-2]\.[0-9]{1,3}\.[0-9]{1,3}(?:\+rev[0-9])?/);
.that.matches(/balenaOS\s[1-4]\.[0-9]{1,3}\.[0-9]{1,3}(?:\+rev[0-9])?/);
expect(body)
.to.have.property('supervisor_version')
.that.matches(/(?:[0-9]+\.?){3}/);