Verified Commit 08619cfc authored by Pilou's avatar Pilou

run-tests: add support for linked working trees

Fix this error when a linked working tree is used (see git worktree):

    $ ./tests/run-tests.sh git describe
    Creating or refreshing the docker image to run the tests...done!
    fatal: not a git repository:
    infrastructure/.git/worktrees/a_worktree

pbr uses git commands: mount git-dir too.
parent 7af8be68
......@@ -126,6 +126,12 @@ function run_tests() {
args="--workdir /opt"
else
args="--volume ${d}:${d} --workdir ${d} --volume $HOME/.enough:$HOME/.enough --volume $HOME/.ansible:$HOME/.ansible -e HOME=$HOME"
# handle git worktree
git_dir="$(git rev-parse --absolute-git-dir)"
if [ "${git_dir}" != "${d}/.git" ]; then
git_common_dir="$(git rev-parse --git-common-dir)"
args="$args --volume ${git_common_dir}:${git_common_dir}"
fi
fi
docker run --rm --device=/dev/net/tun --name $name --user "${USER:-root}" -e ENOUGH_API_TOKEN=$ENOUGH_API_TOKEN $skip --cap-add=NET_ADMIN $args --volume /var/run/docker.sock:/var/run/docker.sock $name "${@:-tox}"
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment