Skip to content

Commit 457f679

Browse files
committed
fix: modify owner of files on mounted volumes
1 parent fbd42a3 commit 457f679

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

docker.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,13 @@ sudo -E apt-get -y -qq update
109109
sudo -E apt-get -y -qq install apt-utils build-essential curl git lsb-release python-pip python-setuptools wget
110110

111111
# add user for testing
112-
adduser --disabled-password --gecos "" travis
113-
adduser travis sudo
114-
chown -R travis:travis $HOME
115-
echo "travis ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
112+
id travis 1>/dev/null 2>&1
113+
if [ $? -ne 0 ]; then
114+
sudo -E adduser --disabled-password --gecos "" travis
115+
sudo -E adduser travis sudo
116+
sudo -E chown -R travis:travis $HOME
117+
fi
118+
echo "travis ALL=(ALL) NOPASSWD:ALL" | sudo -E tee -a /etc/sudoers
116119

117120
# check display
118121
sudo -E apt-get -y -qq install mesa-utils
@@ -125,4 +128,4 @@ export USE_TRAVIS=true
125128
travis_time_end
126129

127130
# run tests
128-
su travis -c 'cd $CI_SOURCE_PATH; source .travis/travis.sh'
131+
sudo -E su travis -c 'cd $CI_SOURCE_PATH; source .travis/travis.sh'

travis.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ if [ "$USE_DOCKER" = true ]; then
9191
fi
9292

9393
docker pull $DOCKER_IMAGE || true
94-
docker run -v $HOME:$HOME \
94+
docker run -i\
95+
-v $HOME:$HOME \
96+
-v /etc/group:/etc/group:ro \
97+
-v /etc/passwd:/etc/passwd:ro \
98+
-v /etc/shadow:/etc/shadow:ro \
99+
-v /etc/sudoers.d:/etc/sudoers.d:ro \
95100
$DOCKER_XSERVER_OPTIONS \
96101
-e TRAVIS_BRANCH -e TRAVIS_COMMIT -e TRAVIS_JOB_ID -e TRAVIS_OS_NAME -e TRAVIS_PULL_REQUEST -e TRAVIS_REPO_SLUG \
97102
-e CI_SOURCE_PATH -e HOME -e REPOSITORY_NAME \

0 commit comments

Comments
 (0)