Skip to content

Commit 4c9791c

Browse files
authored
[ci] clone ot-br-posix submodules recursively in CI/CD (openthread#13130)
When cloning the ot-br-posix repository to run the Docker-in-Docker integration tests, the clone was shallow and did not recursively check out nested submodules (such as cJSON and cpp-httplib). This led to build failures inside the Docker build container since libcjson is not pre-installed on the base build image. This commit resolves the issue by: 1. Appending the `--recurse-submodules` flag to the git-tool clone calls in `otbr-posix-dind.yml` and `script/test`. 2. Updating `script/git-tool`'s destination directory parsing to robustly handle multi-line output from recursive submodule checkouts. The new pattern extracts the path exclusively from the first line using `sed` to prevent SIGPIPE or parsing errors.
1 parent fa5bb3b commit 4c9791c

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/otbr-posix-dind.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Clone ot-br-posix and replace openthread submodule
6767
run: |
6868
OPENTHREAD_DIR=$(pwd)
69-
./script/git-tool clone https://github.com/openthread/ot-br-posix.git --depth 1 /tmp/ot-br-posix
69+
./script/git-tool clone https://github.com/openthread/ot-br-posix.git --depth 1 --recurse-submodules --shallow-submodules /tmp/ot-br-posix
7070
cd /tmp/ot-br-posix
7171
rm -rf third_party/openthread/repo
7272
mkdir -p third_party/openthread/repo

script/git-tool

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ try_clone()
6565
shift
6666
git clone "$@" 2>&1
6767
else
68-
dest_dir="$(git clone "$@" 2>&1 | tee | cut -d\' -f2)"
68+
dest_dir="$(LC_ALL=C git clone "$@" 2>&1 | tee /dev/stderr | sed -n "s/^Cloning into '\([^']*\)'.*/\1/p")"
69+
dest_dir="${dest_dir%%$'\n'*}"
6970

7071
cd "${dest_dir}"
7172
apply_dependencies

script/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ do_build_otbr_docker()
395395

396396
(
397397
if [[ -z ${LOCAL_OTBR_DIR} ]]; then
398-
./script/git-tool clone https://github.com/openthread/ot-br-posix.git --depth 1 "${otbrdir}"
398+
./script/git-tool clone https://github.com/openthread/ot-br-posix.git --depth 1 --recurse-submodules --shallow-submodules "${otbrdir}"
399399
else
400400
rsync -r \
401401
--exclude=third_party/openthread/repo \

0 commit comments

Comments
 (0)