瀏覽代碼

ci(ct/run.sh): use host uid and gid in erlang container for ct

Ivan Dyachkov 3 年之前
父節點
當前提交
d90b3760b1
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. 2 0
      .ci/docker-compose-file/docker-compose.yaml
  2. 2 3
      scripts/ct/run.sh

+ 2 - 0
.ci/docker-compose-file/docker-compose.yaml

@@ -18,8 +18,10 @@ services:
       - emqx_bridge
     volumes:
       - ../..:/emqx
+      - ./.cache:/.cache
     working_dir: /emqx
     tty: true
+    user: "${UID_GID}"
 
 networks:
   emqx_bridge:

+ 2 - 3
scripts/ct/run.sh

@@ -90,7 +90,7 @@ for file in "${FILES[@]}"; do
 done
 
 # shellcheck disable=2086 # no quotes for F_OPTIONS
-docker-compose $F_OPTIONS up -d --build
+UID_GID="$(id -u):$(id -g)" docker-compose $F_OPTIONS up -d --build
 
 # /emqx is where the source dir is mounted to the Erlang container
 # in .ci/docker-compose-file/docker-compose.yaml
@@ -98,7 +98,6 @@ TTY=''
 if [[ -t 1 ]]; then
     TTY='-t'
 fi
-docker exec -i $TTY "$ERLANG_CONTAINER" bash -c 'git config --global --add safe.directory /emqx'
 
 if [ "$CONSOLE" = 'yes' ]; then
     docker exec -i $TTY "$ERLANG_CONTAINER" bash -c "make run"
@@ -107,6 +106,6 @@ else
     docker exec -i $TTY "$ERLANG_CONTAINER" bash -c "make ${WHICH_APP}-ct"
     RESULT=$?
     # shellcheck disable=2086 # no quotes for F_OPTIONS
-    docker-compose $F_OPTIONS down
+    UID_GID="$(id -u):$(id -g)" docker-compose $F_OPTIONS down
     exit $RESULT
 fi