chore: manually initialize .erlang.cookie for ct_docker
This commit is contained in:
parent
7bbd6353aa
commit
c1255188db
|
@ -89,9 +89,13 @@ for file in "${FILES[@]}"; do
|
||||||
F_OPTIONS="$F_OPTIONS -f $file"
|
F_OPTIONS="$F_OPTIONS -f $file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Passing $UID to docker-compose to be used in erlang container
|
||||||
|
# as owner of the main process to avoid git repo permissions issue.
|
||||||
|
# Permissions issue happens because we are mounting local filesystem
|
||||||
|
# where files are owned by $UID to docker container where it's using
|
||||||
|
# root (UID=0) by default, and git is not happy about it.
|
||||||
# shellcheck disable=2086 # no quotes for F_OPTIONS
|
# shellcheck disable=2086 # no quotes for F_OPTIONS
|
||||||
UID_GID="$(id -u):$(id -g)"
|
UID_GID="$UID:$UID" docker-compose $F_OPTIONS up -d --build
|
||||||
UID_GID=$UID_GID docker-compose $F_OPTIONS up -d --build
|
|
||||||
|
|
||||||
# /emqx is where the source dir is mounted to the Erlang container
|
# /emqx is where the source dir is mounted to the Erlang container
|
||||||
# in .ci/docker-compose-file/docker-compose.yaml
|
# in .ci/docker-compose-file/docker-compose.yaml
|
||||||
|
@ -100,8 +104,10 @@ if [[ -t 1 ]]; then
|
||||||
TTY='-t'
|
TTY='-t'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker exec -i $TTY -u root:root "$ERLANG_CONTAINER" bash -c "mkdir /.cache && chown $UID_GID /.cache"
|
# rebar and hex cache directory need to be writable by $UID
|
||||||
docker exec -i $TTY -u root:root "$ERLANG_CONTAINER" bash -c "touch /.erlang.cookie && chown $UID_GID /.erlang.cookie"
|
docker exec -i $TTY -u root:root "$ERLANG_CONTAINER" bash -c "mkdir /.cache && chown $UID:$UID /.cache"
|
||||||
|
# need to initialize .erlang.cookie manually here because / is not writable by $UID
|
||||||
|
docker exec -i $TTY -u root:root "$ERLANG_CONTAINER" bash -c "openssl rand -base64 16 > /.erlang.cookie && chown $UID:$UID /.erlang.cookie && chmod 0400 /.erlang.cookie"
|
||||||
if [ "$CONSOLE" = 'yes' ]; then
|
if [ "$CONSOLE" = 'yes' ]; then
|
||||||
docker exec -i $TTY "$ERLANG_CONTAINER" bash -c "make run"
|
docker exec -i $TTY "$ERLANG_CONTAINER" bash -c "make run"
|
||||||
else
|
else
|
||||||
|
@ -109,6 +115,6 @@ else
|
||||||
docker exec -i $TTY "$ERLANG_CONTAINER" bash -c "make ${WHICH_APP}-ct"
|
docker exec -i $TTY "$ERLANG_CONTAINER" bash -c "make ${WHICH_APP}-ct"
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
# shellcheck disable=2086 # no quotes for F_OPTIONS
|
# shellcheck disable=2086 # no quotes for F_OPTIONS
|
||||||
UID_GID=$UID_GID docker-compose $F_OPTIONS down
|
UID_GID="$UID:$UID" docker-compose $F_OPTIONS down
|
||||||
exit $RESULT
|
exit $RESULT
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue