Skip to content

Commit d9be6d6

Browse files
committed
Add ShellCheck Action
Signed-off-by: Jonh Wendell <[email protected]>
1 parent c7611fe commit d9be6d6

File tree

7 files changed

+36
-16
lines changed

7 files changed

+36
-16
lines changed

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/*.sh'
7+
8+
jobs:
9+
shellcheck:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Install ShellCheck
17+
run: sudo apt-get update && sudo apt-get install -y shellcheck
18+
19+
- name: Run ShellCheck on all scripts
20+
run: |
21+
# Find all .sh files and run shellcheck
22+
# -f gcc makes the output clickable in GitHub UI
23+
shopt -s globstar nullglob
24+
shellcheck -f gcc **/*.sh

docker/linux/debian/docker-entrypoint.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ start_docker () {
2020
get_docker_info () {
2121
DOCKER_GID=$(stat -c '%g' $DOCKER_SOCK)
2222
DOCKER_GROUP=$(stat -c '%G' $DOCKER_SOCK)
23-
EXISTING_GROUP=$(getent group $DOCKER_GID | cut -d: -f1)
23+
EXISTING_GROUP=$(getent group "$DOCKER_GID" | cut -d: -f1)
2424
echo "Docker socket found with GID: $DOCKER_GID (group: $DOCKER_GROUP)"
2525
}
2626

@@ -37,14 +37,14 @@ set_user_permissions () {
3737
set_user_groups () {
3838
if [[ -z "$EXISTING_GROUP" ]]; then
3939
echo "Creating docker group with GID $DOCKER_GID"
40-
groupadd -g $DOCKER_GID docker
40+
groupadd -g "$DOCKER_GID" docker
4141
DOCKER_GROUP="docker"
4242
else
4343
echo "Using existing group: $EXISTING_GROUP"
4444
DOCKER_GROUP=$EXISTING_GROUP
4545
fi
4646
echo "Adding user envoybuild to group $DOCKER_GROUP" >&2
47-
usermod -aG $DOCKER_GROUP envoybuild
47+
usermod -aG "$DOCKER_GROUP" envoybuild
4848
}
4949

5050
start_docker
@@ -53,9 +53,8 @@ set_user_permissions
5353
set_user_groups
5454

5555
if [[ -f /entrypoint-extra.sh ]]; then
56+
# shellcheck disable=SC1091
5657
. /entrypoint-extra.sh
5758
fi
59+
5860
exec gosu envoybuild "$@"
59-
if [[ -f /cleanup.sh ]]; then
60-
. /cleanup.sh
61-
fi

docker/linux/debian/entrypoint.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ if [[ -e /home/envoybuild/.cache ]]; then
88
chown envoybuild:envoybuild /home/envoybuild/.cache
99
fi
1010
if [[ -f /entrypoint-extra.sh ]]; then
11+
# shellcheck disable=SC1091
1112
. /entrypoint-extra.sh
1213
fi
14+
1315
exec gosu envoybuild "$@"
14-
if [[ -f /cleanup.sh ]]; then
15-
. /cleanup.sh
16-
fi

docker/linux/debian/fun.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ COMMON_PACKAGES=(
1414
ca-certificates
1515
libtinfo5
1616
patch)
17-
DEV_PACKAGES=()
1817
CI_PACKAGES=(git gosu sudo)
1918
DEBIAN_PACKAGES=(
2019
aspell

docker/linux/debian/llvm-entrypoint.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ if [[ -e /home/envoybuild/.cache ]]; then
99
chown envoybuild:envoybuild /home/envoybuild/.cache
1010
fi
1111
if [[ -f /entrypoint-extra.sh ]]; then
12+
# shellcheck disable=SC1091
1213
. /entrypoint-extra.sh
1314
fi
15+
1416
exec gosu envoybuild "$@"
15-
if [[ -f /cleanup.sh ]]; then
16-
. /cleanup.sh
17-
fi

docker/linux/group_manifests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ append_variant () {
1919
local repo=$1
2020
local variant=$2
2121
local arch=$3
22-
local flags
2322

2423
tag="${repo}:${variant}-${TAG_SHA}-${arch}"
2524
if ! exists "$tag"; then

docker/push.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
set -e
66

77
IMAGE_PREFIX="${IMAGE_PREFIX:-envoyproxy/envoy-build-}"
8-
GCR_IMAGE_PREFIX=gcr.io/envoy-ci/
98
# Enable docker experimental
109
export DOCKER_CLI_EXPERIMENTAL=enabled
1110
CONTAINER_SHA="${CONTAINER_SHA:-$(git log -1 --pretty=format:"%H" .)}"
12-
CONTAINER_TAG="${CONTAINER_SHA}"
11+
export CONTAINER_TAG="${CONTAINER_SHA}"
1312
IMAGE_TAGS=()
1413
OCI_OUTPUT_DIR="oci-output"
1514

@@ -83,8 +82,10 @@ export BASE_IMAGE_NAME
8382

8483
# Use distro-specific build script if available
8584
if [[ "${OS_DISTRO}" == "debian" && -f "./debian_build.sh" ]]; then
85+
# shellcheck disable=SC1091
8686
source "./debian_build.sh"
8787
else
88+
# shellcheck disable=SC1091
8889
source "./build.sh"
8990
fi
9091

0 commit comments

Comments
 (0)