Skip to content
Snippets Groups Projects
Commit d78ddfaf authored by Konrad Botor's avatar Konrad Botor Committed by Bartek Wrona
Browse files

Added ShellCheck to pre-commit hooks

parent 91414c8e
No related branches found
No related tags found
2 merge requests!326V1.27.5.8 release,!317Added Docker labels and tagging Docker images with Git tags
...@@ -61,9 +61,13 @@ repos: ...@@ -61,9 +61,13 @@ repos:
- "--create" - "--create"
- "--python-folders" - "--python-folders"
- "\ - "\
tests/clive-local-tools/clive_local_tools,\ tests/clive-local-tools/clive_local_tools,\
tests/functional/,\ tests/functional/,\
tests/tui/,\ tests/tui/,\
tests/unit/,\ tests/unit/,\
clive, clive,
" "
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
external-sources=true
...@@ -12,4 +12,4 @@ if [[ $amount_of_occurences -ne 0 ]]; then ...@@ -12,4 +12,4 @@ if [[ $amount_of_occurences -ne 0 ]]; then
echo "Error! Found $amount_of_occurences occurrences of private key or password" echo "Error! Found $amount_of_occurences occurrences of private key or password"
find_password_private_keys 2>&1 find_password_private_keys 2>&1
fi; fi;
exit $amount_of_occurences exit "$amount_of_occurences"
...@@ -5,7 +5,7 @@ SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" ...@@ -5,7 +5,7 @@ SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
SCRIPTSDIR="$SCRIPTPATH/.." SCRIPTSDIR="$SCRIPTPATH/.."
export LOG_FILE=build_instance.log export LOG_FILE=build_instance.log
# shellcheck source=../common.sh # shellcheck source=scripts/common.sh
source "$SCRIPTSDIR/common.sh" source "$SCRIPTSDIR/common.sh"
BUILD_IMAGE_TAG="" BUILD_IMAGE_TAG=""
......
...@@ -45,8 +45,8 @@ do_clone() { ...@@ -45,8 +45,8 @@ do_clone() {
local commit="$4" local commit="$4"
if [[ "$commit" != "" ]]; then if [[ "$commit" != "" ]]; then
do_clone_commit $commit "$src_dir" $repo_url do_clone_commit "$commit" "$src_dir" "$repo_url"
else else
do_clone_branch "$branch" "$src_dir" $repo_url do_clone_branch "$branch" "$src_dir" "$repo_url"
fi fi
} }
#! /bin/bash #! /bin/bash
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1; pwd -P )"
echo "$SCRIPTPATH" echo "$SCRIPTPATH"
LOG_FILE=run_instance.log export LOG_FILE=run_instance.log
# shellcheck source=scripts/common.sh
source "$SCRIPTPATH/common.sh" source "$SCRIPTPATH/common.sh"
log_exec_params "$@" log_exec_params "$@"
...@@ -53,8 +54,11 @@ while [ $# -gt 0 ]; do ...@@ -53,8 +54,11 @@ while [ $# -gt 0 ]; do
;; ;;
--docker-option=*) --docker-option=*)
option="${1#*=}" options_string="${1#*=}"
add_docker_arg "$option" IFS=" " read -ra options <<< "$options_string"
for option in "${options[@]}"; do
add_docker_arg "$option"
done
;; ;;
--help) --help)
print_help print_help
...@@ -86,5 +90,14 @@ CMD_ARGS+=("${CLIVE_ARGS[@]}") ...@@ -86,5 +90,14 @@ CMD_ARGS+=("${CLIVE_ARGS[@]}")
#echo "Using docker image: $IMAGE_NAME" #echo "Using docker image: $IMAGE_NAME"
#echo "Additional hived args: ${CMD_ARGS[@]}" #echo "Additional hived args: ${CMD_ARGS[@]}"
# If command 'tput' exists
if command -v tput &> /dev/null
then
add_docker_arg "--env"
add_docker_arg "COLUMNS=$(tput cols)"
add_docker_arg "--env"
add_docker_arg "LINES=$(tput lines)"
fi
docker container rm -f -v "$CONTAINER_NAME" 2>/dev/null || true docker container rm -f -v "$CONTAINER_NAME" 2>/dev/null || true
docker run --rm -it -e HIVED_UID=$(id -u) -e COLUMNS=$(tput cols) -e LINES=$(tput lines) --name "$CONTAINER_NAME" --stop-timeout=180 ${DOCKER_ARGS[@]} "${IMAGE_NAME}" "${CMD_ARGS[@]}" docker run --rm -it -e HIVED_UID="$(id -u)" --name "$CONTAINER_NAME" --stop-timeout=180 "${DOCKER_ARGS[@]}" "${IMAGE_NAME}" "${CMD_ARGS[@]}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment