From 5ea20e8d1b89e7264f9766f7e74fa404126d4248 Mon Sep 17 00:00:00 2001 From: Andrew Durbin Date: Mon, 22 Dec 2025 11:16:37 -0700 Subject: [PATCH] spec.sh json output fix for pkg/debug build. pkg/debug build blocked by spec.sh json output - Move COMMA variable out of output - skip non-link files in /sys/class/net. This may be only an issue when building pkg/debug on MacOS aarch64 building for ZARCH=amd64 due to the Docker desktop shim linux kernel. - "docker build -f Dockerfile.spec ." to quickly test spec.sh Signed-off-by: Andrew Durbin (cherry picked from commit 780f0c0f0a3b951de38fec809063b6c2d9b2371a) --- pkg/debug/Dockerfile.spec | 18 ++++++++++++++++++ pkg/debug/spec.sh | 6 +++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 pkg/debug/Dockerfile.spec diff --git a/pkg/debug/Dockerfile.spec b/pkg/debug/Dockerfile.spec new file mode 100644 index 00000000000..be215360ee8 --- /dev/null +++ b/pkg/debug/Dockerfile.spec @@ -0,0 +1,18 @@ +FROM lfedge/eve-alpine:745ae9066273c73b0fd879c4ba4ff626a8392d04 + +ENV BUILD_PKGS="jq pciutils usbutils lsblk" + +RUN eve-alpine-deploy.sh + +WORKDIR /usr/bin +COPY spec.sh . + +SHELL ["/bin/ash", "-eo", "pipefail", "-c"] + +RUN echo "Testing spec.sh -v..." && \ + ./spec.sh -v | tee /dev/stderr | jq . > /dev/null + +RUN echo "Testing spec.sh..." && \ + ./spec.sh | tee /dev/stderr | jq . > /dev/null + +CMD ["./spec.sh", "-v"] \ No newline at end of file diff --git a/pkg/debug/spec.sh b/pkg/debug/spec.sh index ae28277b11a..1b14a658b0c 100755 --- a/pkg/debug/spec.sh +++ b/pkg/debug/spec.sh @@ -271,8 +271,8 @@ __EOT__ __EOT__ cat <<__EOT__ "usagePolicy": {} - COMMA="}," __EOT__ + COMMA="}," fi } @@ -479,6 +479,10 @@ done #enumerate NICs (ignoring USB devices) for ETH in /sys/class/net/*; do + if [ ! -L "$ETH" ]; then + # skip bonding_masters file + continue + fi LABEL=$(echo "$ETH" | sed -e 's#/sys/class/net/##' -e 's#^k##') # Does $LABEL start with wlan or wwan? Change ztype and cost COST=0