Skip to content

Commit bf78ad8

Browse files
authored
docker: Fix argument passing in build-all.sh (project-chip#73423)
Use bash array to correctly preserve and forward arguments from build-all.sh to build.sh, avoiding splitting them on spaces incorrectly when passed as a single quoted string.
1 parent 9c55ebd commit bf78ad8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

integrations/docker/build-all.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
set -e
2525

2626
SUB_PATH="*"
27-
ALL_ARGS=""
27+
ALL_ARGS=()
2828
SKIP_BUILT=0
2929

3030
for i in "$@"; do
@@ -43,7 +43,7 @@ for i in "$@"; do
4343
SKIP_BUILT=1
4444
;;
4545
*)
46-
ALL_ARGS="$ALL_ARGS ${i#*=}"
46+
ALL_ARGS+=("$i")
4747
;;
4848
esac
4949
done
@@ -55,10 +55,10 @@ echo "VERSION: $VERSION"
5555

5656
function build_image() {
5757
PARSE_PATH=$1
58-
ARGS_TO_PASS=$2
58+
shift
5959

6060
echo "PARSE_PATH: $PARSE_PATH"
61-
echo "ARGS_TO_PASS: $ARGS_TO_PASS"
61+
echo "ARGS_TO_PASS: $@"
6262

6363
find "$(git rev-parse --show-toplevel)"/integrations/docker/images/$PARSE_PATH -name Dockerfile ! -path "*chip-cert-bins/*" | sort | while read -r dockerfile; do
6464
# Images are of the form `ghcr.io/project-chip/{name}` and tagged as "${VERSION}"
@@ -72,9 +72,9 @@ function build_image() {
7272

7373
echo "BUILDING $(dirname "$dockerfile") (i.e. ${IMAGE_NAME})"
7474
pushd "$(dirname "$dockerfile")" >/dev/null
75-
./build.sh "$ARGS_TO_PASS"
75+
./build.sh "$@"
7676
popd >/dev/null
7777
done
7878
}
7979

80-
build_image "$SUB_PATH" "$ALL_ARGS"
80+
build_image "$SUB_PATH" "${ALL_ARGS[@]}"

0 commit comments

Comments
 (0)