mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-08 12:54:05 +00:00
shellcheck: Fix shellcheck SC2068
> Double quote array expansions to avoid re-splitting elements Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
parent
58672068ff
commit
c5ff513e0b
@ -67,7 +67,7 @@ wait_for_reboot() {
|
|||||||
local workers=($(oc get nodes | \
|
local workers=($(oc get nodes | \
|
||||||
awk '{if ($3 == "worker") { print $1 } }'))
|
awk '{if ($3 == "worker") { print $1 } }'))
|
||||||
# Get the boot ID to compared it changed over time.
|
# Get the boot ID to compared it changed over time.
|
||||||
for node in ${workers[@]}; do
|
for node in "${workers[@]}"; do
|
||||||
BOOTIDS[$node]=$(oc get -o jsonpath='{.status.nodeInfo.bootID}'\
|
BOOTIDS[$node]=$(oc get -o jsonpath='{.status.nodeInfo.bootID}'\
|
||||||
node/$node)
|
node/$node)
|
||||||
echo "Wait $node reboot"
|
echo "Wait $node reboot"
|
||||||
@ -83,7 +83,7 @@ wait_for_reboot() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "Checking after $(($now - $timer_start)) seconds"
|
echo "Checking after $(($now - $timer_start)) seconds"
|
||||||
for i in ${!workers[@]}; do
|
for i in "${!workers[@]}"; do
|
||||||
current_id=$(oc get \
|
current_id=$(oc get \
|
||||||
-o jsonpath='{.status.nodeInfo.bootID}' \
|
-o jsonpath='{.status.nodeInfo.bootID}' \
|
||||||
node/${workers[i]})
|
node/${workers[i]})
|
||||||
|
@ -94,14 +94,14 @@ target=$1
|
|||||||
# compile all proto files
|
# compile all proto files
|
||||||
if [ "$target" = "all" ]; then
|
if [ "$target" = "all" ]; then
|
||||||
# compile all proto files
|
# compile all proto files
|
||||||
for f in ${proto_files_list[@]}; do
|
for f in "${proto_files_list[@]}"; do
|
||||||
echo -e "\n [golang] compiling ${f} ..."
|
echo -e "\n [golang] compiling ${f} ..."
|
||||||
generate_go_sources $f
|
generate_go_sources $f
|
||||||
echo -e " [golang] ${f} compiled\n"
|
echo -e " [golang] ${f} compiled\n"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
# compile individual proto file
|
# compile individual proto file
|
||||||
for f in ${proto_files_list[@]}; do
|
for f in "${proto_files_list[@]}"; do
|
||||||
if [ "$target" = "$f" ]; then
|
if [ "$target" = "$f" ]; then
|
||||||
echo -e "\n [golang] compiling ${target} ..."
|
echo -e "\n [golang] compiling ${target} ..."
|
||||||
generate_go_sources $target
|
generate_go_sources $target
|
||||||
|
@ -19,7 +19,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Run tests"
|
info "Run tests"
|
||||||
for KATA_DEPLOY_TEST_ENTRY in ${KATA_DEPLOY_TEST_UNION[@]}
|
for KATA_DEPLOY_TEST_ENTRY in "${KATA_DEPLOY_TEST_UNION[@]}"
|
||||||
do
|
do
|
||||||
bats --show-output-of-passing-tests "${KATA_DEPLOY_TEST_ENTRY}"
|
bats --show-output-of-passing-tests "${KATA_DEPLOY_TEST_ENTRY}"
|
||||||
done
|
done
|
||||||
|
@ -80,7 +80,7 @@ cleanup() {
|
|||||||
|
|
||||||
# Destroy mediated devices
|
# Destroy mediated devices
|
||||||
IFS=$'\n' read -r -d '' -a arr_dev < <( ls -1 /sys/bus/mdev/devices && printf '\0' )
|
IFS=$'\n' read -r -d '' -a arr_dev < <( ls -1 /sys/bus/mdev/devices && printf '\0' )
|
||||||
for item in ${arr_dev[@]}; do
|
for item in "${arr_dev[@]}"; do
|
||||||
if [[ ${item//-/} =~ ^[[:xdigit:]]{32}$ ]]; then
|
if [[ ${item//-/} =~ ^[[:xdigit:]]{32}$ ]]; then
|
||||||
echo 1 | sudo tee /sys/bus/mdev/devices/${item}/remove > /dev/null
|
echo 1 | sudo tee /sys/bus/mdev/devices/${item}/remove > /dev/null
|
||||||
fi
|
fi
|
||||||
@ -100,7 +100,7 @@ validate_env() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
necessary_commands=( "${container_engine}" "ctr" "crictl" "lszcrypt" )
|
necessary_commands=( "${container_engine}" "ctr" "crictl" "lszcrypt" )
|
||||||
for cmd in ${necessary_commands[@]}; do
|
for cmd in "${necessary_commands[@]}"; do
|
||||||
if ! which ${cmd} > /dev/null 2>&1; then
|
if ! which ${cmd} > /dev/null 2>&1; then
|
||||||
echo "${cmd} not found" >&2
|
echo "${cmd} not found" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -244,4 +244,4 @@ main() {
|
|||||||
run_tests
|
run_tests
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main "$@"
|
||||||
|
@ -23,13 +23,13 @@ function install_dependencies() {
|
|||||||
deps=(xorriso curl qemu-utils openssh-client)
|
deps=(xorriso curl qemu-utils openssh-client)
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y ${deps[@]} qemu-system-x86
|
sudo apt-get install -y "${deps[@]}" qemu-system-x86
|
||||||
;;
|
;;
|
||||||
fedora)
|
fedora)
|
||||||
# cloud image dependencies
|
# cloud image dependencies
|
||||||
deps=(xorriso curl qemu-img openssh)
|
deps=(xorriso curl qemu-img openssh)
|
||||||
|
|
||||||
sudo dnf install -y ${deps[@]} qemu-system-x86-core
|
sudo dnf install -y "${deps[@]}" qemu-system-x86-core
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"*")
|
"*")
|
||||||
|
@ -347,4 +347,4 @@ main() {
|
|||||||
check_vfio "${vfio_cid}"
|
check_vfio "${vfio_cid}"
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main "$@"
|
||||||
|
@ -326,4 +326,4 @@ main() {
|
|||||||
ssh_vm "/home/${USER}/run.sh"
|
ssh_vm "/home/${USER}/run.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main "$@"
|
||||||
|
@ -52,7 +52,7 @@ main()
|
|||||||
done
|
done
|
||||||
[ "$flag" == "false" ] && result+=("$TEST_ENTRY")
|
[ "$flag" == "false" ] && result+=("$TEST_ENTRY")
|
||||||
done
|
done
|
||||||
echo ${result[@]}
|
echo "${result[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
@ -132,7 +132,7 @@ ensure_yq
|
|||||||
info "Running tests with bats version: $(bats --version)"
|
info "Running tests with bats version: $(bats --version)"
|
||||||
|
|
||||||
tests_fail=()
|
tests_fail=()
|
||||||
for K8S_TEST_ENTRY in ${K8S_TEST_UNION[@]}
|
for K8S_TEST_ENTRY in "${K8S_TEST_UNION[@]}"
|
||||||
do
|
do
|
||||||
info "$(kubectl get pods --all-namespaces 2>&1)"
|
info "$(kubectl get pods --all-namespaces 2>&1)"
|
||||||
info "Executing ${K8S_TEST_ENTRY}"
|
info "Executing ${K8S_TEST_ENTRY}"
|
||||||
|
@ -238,7 +238,7 @@ add_requests_to_policy_settings() {
|
|||||||
|
|
||||||
auto_generate_policy_enabled || return 0
|
auto_generate_policy_enabled || return 0
|
||||||
|
|
||||||
for request in ${requests[@]}
|
for request in "${requests[@]}"
|
||||||
do
|
do
|
||||||
info "${settings_dir}/genpolicy-settings.json: allowing ${request}"
|
info "${settings_dir}/genpolicy-settings.json: allowing ${request}"
|
||||||
jq ".request_defaults.${request} |= true" \
|
jq ".request_defaults.${request} |= true" \
|
||||||
|
@ -96,7 +96,7 @@ function generate_build_dockerfile()
|
|||||||
local text_to_replace="$4"
|
local text_to_replace="$4"
|
||||||
local regs=(${registries["${map_key}"]})
|
local regs=(${registries["${map_key}"]})
|
||||||
|
|
||||||
for r in ${regs[@]}; do
|
for r in "${regs[@]}"; do
|
||||||
sed 's|'${text_to_replace}'|'${r}'|g' \
|
sed 's|'${text_to_replace}'|'${r}'|g' \
|
||||||
"${dockerfile}.in" > "${dockerfile}"
|
"${dockerfile}.in" > "${dockerfile}"
|
||||||
if sudo -E "${DOCKER_EXE}" build \
|
if sudo -E "${DOCKER_EXE}" build \
|
||||||
|
@ -19,4 +19,4 @@ supported_artifacts=(
|
|||||||
"install_qemu"
|
"install_qemu"
|
||||||
)
|
)
|
||||||
|
|
||||||
for c in ${supported_artifacts[@]}; do echo $c; done
|
for c in "${supported_artifacts[@]}"; do echo $c; done
|
||||||
|
@ -145,7 +145,7 @@ docker run \
|
|||||||
--env ARCH="${ARCH}" \
|
--env ARCH="${ARCH}" \
|
||||||
--rm \
|
--rm \
|
||||||
-w ${script_dir} \
|
-w ${script_dir} \
|
||||||
build-kata-deploy "${kata_deploy_create}" $@
|
build-kata-deploy "${kata_deploy_create}" "$@"
|
||||||
|
|
||||||
if [ $remove_dot_docker_dir == true ]; then
|
if [ $remove_dot_docker_dir == true ]; then
|
||||||
rm -rf "$HOME/.docker"
|
rm -rf "$HOME/.docker"
|
||||||
|
@ -193,7 +193,7 @@ cleanup_and_fail() {
|
|||||||
if [ -n "${extra_tarballs}" ]; then
|
if [ -n "${extra_tarballs}" ]; then
|
||||||
local mapping
|
local mapping
|
||||||
IFS=' ' read -a mapping <<< "${extra_tarballs}"
|
IFS=' ' read -a mapping <<< "${extra_tarballs}"
|
||||||
for m in ${mapping[@]}; do
|
for m in "${mapping[@]}"; do
|
||||||
local extra_tarball_name=${m%:*}
|
local extra_tarball_name=${m%:*}
|
||||||
rm -f "${extra_tarball_name}"
|
rm -f "${extra_tarball_name}"
|
||||||
done
|
done
|
||||||
@ -273,7 +273,7 @@ install_cached_tarball_component() {
|
|||||||
|
|
||||||
local mapping
|
local mapping
|
||||||
IFS=' ' read -a mapping <<< "${extra_tarballs}"
|
IFS=' ' read -a mapping <<< "${extra_tarballs}"
|
||||||
for m in ${mapping[@]}; do
|
for m in "${mapping[@]}"; do
|
||||||
local extra_tarball_name=${m%:*}
|
local extra_tarball_name=${m%:*}
|
||||||
local extra_tarball_path=${m#*:}
|
local extra_tarball_path=${m#*:}
|
||||||
|
|
||||||
@ -1470,5 +1470,5 @@ main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
main $@
|
main "$@"
|
||||||
fi
|
fi
|
||||||
|
@ -618,7 +618,7 @@ function configure_containerd_runtime() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${SNAPSHOTTER_HANDLER_MAPPING}" ]; then
|
if [ -n "${SNAPSHOTTER_HANDLER_MAPPING}" ]; then
|
||||||
for m in ${snapshotters[@]}; do
|
for m in "${snapshotters[@]}"; do
|
||||||
key="${m%$snapshotters_delimiter*}"
|
key="${m%$snapshotters_delimiter*}"
|
||||||
|
|
||||||
if [ "${key}" != "${shim}" ]; then
|
if [ "${key}" != "${shim}" ]; then
|
||||||
@ -746,7 +746,7 @@ function snapshotter_handler_mapping_validation_check() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for m in ${snapshotters[@]}; do
|
for m in "${snapshotters[@]}"; do
|
||||||
shim="${m%$snapshotters_delimiter*}"
|
shim="${m%$snapshotters_delimiter*}"
|
||||||
snapshotter="${m#*$snapshotters_delimiter}"
|
snapshotter="${m#*$snapshotters_delimiter}"
|
||||||
|
|
||||||
|
@ -718,4 +718,4 @@ main() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main "$@"
|
||||||
|
@ -143,8 +143,8 @@ function _publish_multiarch_manifest()
|
|||||||
_check_required_env_var "KATA_DEPLOY_IMAGE_TAGS"
|
_check_required_env_var "KATA_DEPLOY_IMAGE_TAGS"
|
||||||
_check_required_env_var "KATA_DEPLOY_REGISTRIES"
|
_check_required_env_var "KATA_DEPLOY_REGISTRIES"
|
||||||
|
|
||||||
for registry in ${REGISTRIES[@]}; do
|
for registry in "${REGISTRIES[@]}"; do
|
||||||
for tag in ${IMAGE_TAGS[@]}; do
|
for tag in "${IMAGE_TAGS[@]}"; do
|
||||||
docker manifest create ${registry}:${tag} \
|
docker manifest create ${registry}:${tag} \
|
||||||
--amend ${registry}:${tag}-amd64 \
|
--amend ${registry}:${tag}-amd64 \
|
||||||
--amend ${registry}:${tag}-arm64 \
|
--amend ${registry}:${tag}-arm64 \
|
||||||
|
@ -38,7 +38,7 @@ echo "INFO: Apply patches from $patches_dir"
|
|||||||
if [ -d "$patches_dir" ]; then
|
if [ -d "$patches_dir" ]; then
|
||||||
patches=($(find "$patches_dir" -maxdepth 1 -name '*.patch'|sort -t- -k1,1n))
|
patches=($(find "$patches_dir" -maxdepth 1 -name '*.patch'|sort -t- -k1,1n))
|
||||||
echo "INFO: Found ${#patches[@]} patches"
|
echo "INFO: Found ${#patches[@]} patches"
|
||||||
for patch in ${patches[@]}; do
|
for patch in "${patches[@]}"; do
|
||||||
echo "INFO: Apply $patch"
|
echo "INFO: Apply $patch"
|
||||||
patch -p1 < "$patch" || \
|
patch -p1 < "$patch" || \
|
||||||
{ echo >&2 "ERROR: Not applied. Exiting..."; exit 1; }
|
{ echo >&2 "ERROR: Not applied. Exiting..."; exit 1; }
|
||||||
|
@ -595,4 +595,4 @@ main() {
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main "$@"
|
||||||
|
@ -185,4 +185,4 @@ main() {
|
|||||||
gen_version_file "${branch}" "${kata_version}"
|
gen_version_file "${branch}" "${kata_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main "$@"
|
||||||
|
@ -38,4 +38,4 @@ build_coco_guest_components_from_source() {
|
|||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
build_coco_guest_components_from_source $@
|
build_coco_guest_components_from_source "$@"
|
||||||
|
@ -19,7 +19,7 @@ fi
|
|||||||
pushd "${QEMU_DESTDIR}"
|
pushd "${QEMU_DESTDIR}"
|
||||||
# Remove files to reduce the surface.
|
# Remove files to reduce the surface.
|
||||||
echo "INFO: remove uneeded files"
|
echo "INFO: remove uneeded files"
|
||||||
for pattern in ${qemu_black_list[@]}; do
|
for pattern in "${qemu_black_list[@]}"; do
|
||||||
find . -path "$pattern" | xargs rm -rfv
|
find . -path "$pattern" | xargs rm -rfv
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -83,4 +83,4 @@ main() {
|
|||||||
info "kata-webhook is up and working"
|
info "kata-webhook is up and working"
|
||||||
}
|
}
|
||||||
|
|
||||||
main $@
|
main "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user