Skip to content

Commit 8e70326

Browse files
committed
fix: Made shellcheck clean, and install jv so the schema test runs
shellcheck findings, all real: - spdx-headers.sh listed */init.test.sys_class_net/* beside *.test.*, which already matches it - those fixture paths contain ".test." too. - init.sh masked the return value of $(cat) behind 'local'. - SLOT is genuinely unused in three install-kernel-* scripts, while grub and uboot use it. Kept and annotated: every install-kernel-* takes the slot as its first argument and the callers pass it. - The two busybox scripts are ash; told shellcheck to read them as dash. The Bash suite failed on 'jv: command not found'. The test's own apk/apt fallback needs root, which the runner is not, and jsonschema-jv is not a Debian package - so CI installs the pinned release binary instead. Both jobs stay continue-on-error until one run proves them green. Signed-off-by: Simon Walz <contact@simonwalz.de>
1 parent bf48c68 commit 8e70326

8 files changed

Lines changed: 30 additions & 6 deletions

File tree

‎.github/scripts/spdx-headers.sh‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ in_scope() {
9595
*.test.sh) return 0 ;;
9696
esac
9797
# Test fixtures: never touch, whatever the extension. A header could change
98-
# what a test compares.
98+
# what a test compares. This also covers the fixture directories, whose paths
99+
# contain ".test." as well - init.test.sys_class_net/eth0/address and the like.
99100
case "${file}" in
100-
*.test.*|*/init.test.sys_class_net/*) return 1 ;;
101+
*.test.*) return 1 ;;
101102
esac
102103

103104
case "${file}" in

‎.github/workflows/ci.yml‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,28 @@ jobs:
9292
tests:
9393
name: Bash test suite
9494
runs-on: ubuntu-latest
95-
# Not yet a gate: two suites fail on missing tools (yq mikefarah v4, jv),
96-
# not on defects — see brain/tasks/fix-failing-tests.md. Remove this line
97-
# once those are installed here or the tests skip cleanly.
95+
# Not yet a gate. jv is installed below, so the schema suite runs; leave
96+
# this until one run has proven that green, then remove it.
97+
# See brain/tasks/fix-failing-tests.md.
9898
continue-on-error: true
9999
steps:
100100
- name: Checkout repository
101101
uses: actions/checkout@v7
102102
103+
# system-schema.test.sh and system/cuos/init.sh validate system.json with
104+
# jv. It is not on the runner, and the script's own apk/apt fallback needs
105+
# root, which the runner is not. Pinned rather than "latest": a validator
106+
# that changes under us turns a green suite red for no reason.
107+
- name: Install jv
108+
shell: bash
109+
env:
110+
JV_VERSION: v6.0.3
111+
run: |
112+
set -euo pipefail
113+
url="https://github.com/santhosh-tekuri/jsonschema/releases/download/${JV_VERSION}/jv-${JV_VERSION}-linux-amd64.tar.gz"
114+
curl -fsSL "${url}" | sudo tar -xz -C /usr/local/bin jv
115+
jv --version
116+
103117
- name: Run every *.test.sh
104118
shell: bash
105119
run: |

‎system/cuos/init.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ configure_network_interface() {
233233
local iface="$1"
234234
local network_interface_id="$2"
235235

236-
local config="$(cat)"
236+
local config
237+
config="$(cat)"
237238
local dhcp
238239
dhcp=$(echo "$config" | jq -r '.dhcp // empty')
239240
local ip

‎system/cuos/install-kernel-rpi-rollback.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ source "${SCRIPT_DIR}/utils.sh"
88

99
set -x
1010

11+
# shellcheck disable=SC2034 # unused here, but every install-kernel-* takes the
12+
# slot as its first argument and the callers pass it uniformly.
1113
SLOT="$1"
1214
# from exports:
1315
# TARGET_BOOT

‎system/cuos/install-kernel-rpi.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ source "${SCRIPT_DIR}/utils.sh"
88

99
set -x
1010

11+
# shellcheck disable=SC2034 # unused here, but every install-kernel-* takes the
12+
# slot as its first argument and the callers pass it uniformly.
1113
SLOT="$1"
1214
# from exports:
1315
# TARGET_BOOT

‎system/cuos/install-kernel-uboot-rollback.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ source "${SCRIPT_DIR}/utils.sh"
88

99
set -x
1010

11+
# shellcheck disable=SC2034 # unused here, but every install-kernel-* takes the
12+
# slot as its first argument and the callers pass it uniformly.
1113
SLOT="$1"
1214
# from exports:
1315
# TARGET_BOOT

‎system/cuos/lxc-swaproot/swap_rollback.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/swaproot/busybox sh
22
# SPDX-License-Identifier: Apache-2.0
3+
# shellcheck shell=dash # busybox ash; dash is the closest dialect shellcheck knows
34

45
dirs="bin boot etc home lib lib64 media mnt opt root run sbin srv tmp usr var system.json system_next.json"
56
# shellcheck disable=SC2123

‎system/cuos/lxc-swaproot/swap_update.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/swaproot/busybox sh
22
# SPDX-License-Identifier: Apache-2.0
3+
# shellcheck shell=dash # busybox ash; dash is the closest dialect shellcheck knows
34

45
dirs="bin boot etc home lib lib64 media mnt opt root run sbin srv tmp usr var system.json system_next.json"
56
# shellcheck disable=SC2123

0 commit comments

Comments
 (0)