mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
Four of the merge gate's thirteen members existed only as inline workflow shell, so a developer could not run them without copying YAML out of a workflow file: actionlint, shellcheck, the chart render and govulncheck. Each is now a target in make/checks.mk, and the workflows call the target instead of holding a second copy of the commands. chart.yml drops from four steps to one. Also adds root `fmt` and `lint`, which loop the modules. `make lint` at the root previously failed with "No rule to make target", which is the most surprising thing a newcomer meets, given all six modules have had a lint target all along. CI keeps calling the module targets directly, so its seven lint jobs stay parallel. `make gate` runs the members that work on a laptop and names the four that do not, with the command and the reason for each. Two bugs found while testing, both of the kind that reports success while checking nothing. The shellcheck collector used `mapfile -d ''`, a bash 4.4 builtin. On macOS bash 3.2 it fails, leaves the array empty and exits 0, so a target copying it would lint zero files and pass. The collector moves to hack/shell-scripts.sh, which emits a NUL list for `xargs -0` and needs no bash 4. shellcheck.yml now calls it too, so there is one definition instead of three. kubeconform selects input files by extension, and `mktemp -t nke-chart-XXXXXX` on macOS appends random characters after the template. The rendered manifest landed at nke-chart-XXXXXX.qlKjrjG4RL, kubeconform skipped it, and the summary read "0 resource found in 0 file" while lint-chart reported success. It now renders into a temporary directory as rendered.yaml, and validates 11 of 11. chart.yml keeps its kubeconform install step. The target skips validation and says so when the tool is absent, which on a runner would silently drop a real check. Every tool is taken from PATH, and a missing one reports which tool, the version CI uses, and both a flox and a non-flox way to get it. Nothing here requires flox. Signed-off-by: Davanum Srinivas <dsrinivas@nvidia.com>
34 lines
1.3 KiB
Bash
Executable File
34 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Print every tracked shell script, NUL separated, for `xargs -0`.
|
|
#
|
|
# Found by extension and by shebang, because `*.sh` alone missed 11 tracked
|
|
# scripts, one of which a Go test runs. This was inline in shellcheck.yml, where
|
|
# a developer could not run it. It is a script, not a recipe, because make runs
|
|
# recipes under /bin/sh and this needs `read -d ''`.
|
|
#
|
|
# No `mapfile`. That is a bash 4.4 builtin, and on macOS bash 3.2 it fails,
|
|
# leaves the array empty and exits 0, so a caller lints zero files and passes.
|
|
set -euo pipefail
|
|
|
|
{
|
|
git ls-files -z -- '*.sh' ':(exclude)vendor/*'
|
|
|
|
# Shebang-bearing files with no extension. Match narrowly: siblings start
|
|
# `#!/usr/bin/env python3` and `#!ipxe`. Take the word after `env` when
|
|
# present, so `#!/bin/bash -e` and `#!/usr/bin/env bash` both resolve.
|
|
while IFS= read -r -d '' path; do
|
|
case "${path##*/}" in *.*) continue ;; esac
|
|
[ -f "${path}" ] || continue
|
|
interp=$(
|
|
sed -n '1s/^#![[:space:]]*//p' "${path}" |
|
|
awk 'NR == 1 { if ($1 ~ /\/env$/) print $2; else print $1 }'
|
|
)
|
|
case "${interp##*/}" in
|
|
sh | bash | dash | ksh) printf '%s\0' "${path}" ;;
|
|
esac
|
|
done < <(git ls-files -z -- ':(exclude)vendor/*')
|
|
} | sort -zu
|