Skip to content

Commit a4c8350

Browse files
committed
chore(plugin): Enable more shellcheck checks
1 parent b2e86d1 commit a4c8350

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ install-docker-plugin:
55
.PHONY: shellcheck
66
shellcheck:
77
find . -path "./tmp" -prune -o -type f \( -name "docker-pussh" -o -name "*.sh" \) -print0 \
8-
| xargs -0 shellcheck -s bash;
8+
| xargs -0 shellcheck -s bash --enable=check-extra-masked-returns,check-set-e-suppressed,quote-safe-variables ;

docker-pussh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ find_containerd_socket() {
162162
fi
163163

164164
local socket_paths=(
165+
"${DEFAULT_CONTAINERD_SOCKET}"
165166
"/var/run/docker/containerd/containerd.sock"
166-
"/run/containerd/containerd.sock"
167167
"/var/run/containerd/containerd.sock"
168168
"/run/docker/containerd/containerd.sock"
169169
"/run/snap.docker/containerd/containerd.sock"
@@ -386,7 +386,7 @@ get_temp_image_name() {
386386
cleanup() {
387387
local exit_code=$?
388388

389-
if [ $exit_code -ne 0 ]; then
389+
if [ "${exit_code}" -ne 0 ]; then
390390
warning "Cleaning up after error..."
391391
fi
392392

@@ -425,8 +425,9 @@ success "Unregistry is listening localhost:$UNREGISTRY_PORT on remote host."
425425
LOCAL_PORT=$(forward_port "$UNREGISTRY_PORT")
426426
success "Forwarded localhost:$LOCAL_PORT to unregistry over SSH connection."
427427

428-
# Handle virtualized Docker on macOS (e.g., Docker Desktop, Colima, etc.)
429428
PUSH_PORT=$LOCAL_PORT
429+
# Handle virtualized Docker on macOS (e.g., Docker Desktop, Colima, etc.)
430+
# shellcheck disable=SC2310
430431
if is_additional_tunneling_needed; then
431432
info "Detected virtualized Docker, creating additional tunnel to localhost:$LOCAL_PORT..."
432433
run_docker_desktop_tunnel "$LOCAL_PORT"
@@ -450,13 +451,13 @@ PUSH_RETRY_COUNT=3
450451
PUSH_SUCCESS=false
451452
PUSH_SLEEP_INTERVAL=3
452453

453-
for attempt in $(seq 1 $PUSH_RETRY_COUNT); do
454+
for attempt in $(seq 1 "${PUSH_RETRY_COUNT}"); do
454455
# That DOCKER_PUSH_OPTS expansion is needed to avoid issues with empty array expansion in older bash versions.
455456
if docker push ${DOCKER_PUSH_OPTS[@]+"${DOCKER_PUSH_OPTS[@]}"} "$REGISTRY_IMAGE"; then
456457
PUSH_SUCCESS=true
457458
break
458459
else
459-
if [ "$attempt" -lt $PUSH_RETRY_COUNT ]; then
460+
if [ "${attempt}" -lt "${PUSH_RETRY_COUNT}" ]; then
460461
warning "Push attempt $attempt failed, retrying in ${PUSH_SLEEP_INTERVAL} seconds..."
461462
sleep "${PUSH_SLEEP_INTERVAL}"
462463
fi

scripts/dind-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ dind dockerd --host=tcp://0.0.0.0:2375 --tls=false &
3333
# Execute the passed command and wait for it while maintaining signal handling.
3434
"$@" &
3535
MAIN_PID=$!
36-
wait $MAIN_PID
36+
wait "${MAIN_PID}"

0 commit comments

Comments
 (0)