From 7d87d594cdf954d8a5f1e6cd43777f5ea2ee3ce4 Mon Sep 17 00:00:00 2001 From: Nashwan Azhari Date: Mon, 9 Sep 2024 20:39:58 +0300 Subject: [PATCH] Minor fixes. Signed-off-by: Nashwan Azhari --- .../sanity/test_longhorn_instance_manager.py | 4 ++ .../longhorn-instance-manager/rockcraft.yaml | 42 ++++++++++++++----- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/tests/sanity/test_longhorn_instance_manager.py b/tests/sanity/test_longhorn_instance_manager.py index 5ec70bf..5a4954f 100644 --- a/tests/sanity/test_longhorn_instance_manager.py +++ b/tests/sanity/test_longhorn_instance_manager.py @@ -74,3 +74,7 @@ def test_check_rock_image_contents(image_version): rock_image, binary_paths_to_check, ) + + process = docker_util.run_in_docker(rock_image, ["nvme", "version"]) + assert "nvme version 2.9.1" in process.stdout + assert "libnvme version 1.9" in process.stdout diff --git a/v1.7.0/longhorn-instance-manager/rockcraft.yaml b/v1.7.0/longhorn-instance-manager/rockcraft.yaml index 94e6650..3de3956 100644 --- a/v1.7.0/longhorn-instance-manager/rockcraft.yaml +++ b/v1.7.0/longhorn-instance-manager/rockcraft.yaml @@ -21,7 +21,9 @@ base: ubuntu@24.04 build-base: ubuntu@24.04 platforms: amd64: - arm64: + +environment: + LD_LIBRARY_PATH: /usr/local/lib services: longhorn-instance-manager: @@ -30,7 +32,8 @@ services: override: replace # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L175-L177 - command: /tini -- [ longhorn ] + # https://github.com/longhorn/longhorn-instance-manager/pull/664 + command: /tini -- [ longhorn-instance-manager ] on-success: shutdown on-failure: shutdown @@ -89,7 +92,7 @@ parts: make -j$(nproc) make install - ldconfig + ldconfig -p # The Makefile targets are just the scripts found in the scripts/ directory which # are executed within the Dapper build container: @@ -114,11 +117,9 @@ parts: bash ./scripts/build - # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L165 + # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L165-L166 mkdir -p $CRAFT_PART_INSTALL/usr/local/bin cp $CRAFT_PART_SRC/bin/longhorn-instance-manager $CRAFT_PART_INSTALL/usr/local/bin - - # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L166 cp package/instance-manager $CRAFT_PART_INSTALL/usr/local/bin # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L18-L26 @@ -199,8 +200,8 @@ parts: make install # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L151-L157 - mkdir -p $CRAFT_PART_INSTALL/usr/local/bin - cp /usr/sbin/{tgt-admin,tgt-setup-lun,tgtadm,tgtd,tgtimg} $CRAFT_PART_INSTALL/usr/local/bin + mkdir -p $CRAFT_PART_INSTALL/usr/sbin + cp /usr/sbin/{tgt-admin,tgt-setup-lun,tgtadm,tgtd,tgtimg} $CRAFT_PART_INSTALL/usr/sbin # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L72-L93 build-spdk: @@ -264,7 +265,11 @@ parts: make make install - # TODO(aznashwan): copy lib to final image + # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L159-L161 + mkdir -p $CRAFT_PART_INSTALL/usr/local/lib + cp /usr/local/lib/libjson-c* $CRAFT_PART_INSTALL/usr/local/lib/ + + ldconfig -p # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L106-L113 build-nvme-cli: @@ -289,8 +294,14 @@ parts: meson install -C .build # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L147-L149 - mkdir -p $CRAFT_PART_INSTALL/usr/local/bin - cp /usr/local/sbin/nvme $CRAFT_PART_INSTALL/usr/local/bin + mkdir -p $CRAFT_PART_INSTALL/usr/local/sbin + cp /usr/local/sbin/nvme $CRAFT_PART_INSTALL/usr/local/sbin + + # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L159-L161 + mkdir -p $CRAFT_PART_INSTALL/usr/local/lib + cp /usr/local/lib/*/libnvme*.so $CRAFT_PART_INSTALL/usr/local/lib/ + + ldconfig -p # Pulls a pre-built binary release of the `tini` init system. # https://github.com/longhorn/longhorn-instance-manager/blob/v1.7.0/package/Dockerfile#L173 @@ -336,4 +347,13 @@ parts: - procps - libfuse3-3 # fuse3-devel - awk + # NOTE(aznashwan): although not explicitly installed in any of the + # upstream build procedures, some of the secondary CLI tools + # (e.g. nvmecli) require libncurses: + - libncurses-dev + + override-build: | + set -eux -o pipefail + + echo /usr/local/lib > $CRAFT_PART_INSTALL/etc/ld.so.conf.d/99_local_libs.conf