Merge pull request #11646 from kata-containers/sprt/param-static-checks

ci: static-checks: Auto-detect repo by default
This commit is contained in:
Hyounggyu Choi
2025-08-05 22:13:20 +02:00
committed by GitHub
2 changed files with 13 additions and 23 deletions

View File

@@ -42,7 +42,7 @@ generate-protocols:
# Some static checks rely on generated source files of components.
static-checks: static-checks-build
bash tests/static-checks.sh github.com/kata-containers/kata-containers
bash tests/static-checks.sh
docs-url-alive-check:
bash ci/docs-url-alive-check.sh

View File

@@ -20,8 +20,6 @@ source "${cidir}/common.bash"
# set GO111MODULE to "auto" to enable module-aware mode only when
# a go.mod file is present in the current directory.
export GO111MODULE="auto"
export test_path="${test_path:-github.com/kata-containers/kata-containers/tests}"
export test_dir="${GOPATH}/src/${test_path}"
# List of files to delete on exit
files_to_remove=()
@@ -125,7 +123,7 @@ usage()
cat <<EOF
Usage: $script_name help
$script_name [options] repo-name [true]
$script_name [options] [repo-name] [true]
Options:
@@ -175,7 +173,7 @@ Examples:
- Auto-detect repository and run golang tests for current repository:
$ KATA_DEV_MODE=true $script_name --golang
$ $script_name --golang
- Run all tests on the kata-containers repository, forcing the tests to
consider all files, not just those changed by a PR branch:
@@ -1231,10 +1229,7 @@ has_hadolint_or_install()
local linter_dest="${GOPATH}/bin/hadolint"
local has_linter=$(command -v "$linter_cmd")
if [[ -z "$has_linter" && "$KATA_DEV_MODE" == "yes" ]]; then
# Do not install if it is in development mode.
die "$linter_cmd command not found. You must have the version $linter_version installed to run this check."
elif [ -n "$has_linter" ]; then
if [ -n "$has_linter" ]; then
# Check if the expected linter version
if $linter_cmd --version | grep -v "$linter_version" &>/dev/null; then
warn "$linter_cmd command found but not the required version $linter_version"
@@ -1560,22 +1555,17 @@ main()
if [ -z "$repo" ]
then
if [ -n "$KATA_DEV_MODE" ]
then
# No repo param provided so assume it's the current
# one to avoid developers having to specify one now
# (backwards compatability).
repo=$(git config --get remote.origin.url |\
sed 's!https://!!g' || true)
info "Auto-detected repo as $repo"
else
if [ "$list_only" != "true" ]; then
echo >&2 "ERROR: need repo" && usage && exit 1
fi
fi
# No repo param provided so assume it's the current
# one to avoid developers having to specify one now
# (backwards compatability).
repo=$(git config --get remote.origin.url |\
sed 's!https://!!g' || true)
info "Auto-detected repo as $repo"
fi
test_path="${test_path:-"${repo}/tests"}"
test_dir="${GOPATH}/src/${test_path}"
repo_path=$GOPATH/src/$repo
announce