Skip to content

Commit

Permalink
Merge pull request #58 from marcinslusarz/travis
Browse files Browse the repository at this point in the history
Stop using sudo on Travis.
  • Loading branch information
marcinslusarz committed Sep 15, 2017
2 parents 1e79b18 + f3d2cc1 commit ab8a2b1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 49 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
language: c

services:
- docker

env:
matrix:
- PUSH_IMAGE=1 MAKE_PKG=1 OS=ubuntu OS_VER=16.04
Expand All @@ -18,7 +21,6 @@ before_install:
- export PROJECT=syscall_intercept
- export EXTRA_DOCKER_ARGS=-t
- cd utils/docker
- ./prepare-environment.sh
- ./pull-or-rebuild-image.sh
- if [[ -f push_image_to_repo_flag ]]; then PUSH_THE_IMAGE=1; fi
- rm -f push_image_to_repo_flag
Expand Down
4 changes: 2 additions & 2 deletions utils/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if [[ -z "$HOST_WORKDIR" ]]; then
exit 1
fi

sudo chmod -R a+w $HOST_WORKDIR
chmod -R a+w $HOST_WORKDIR

if [[ "$TRAVIS_EVENT_TYPE" == "cron" || "$TRAVIS_BRANCH" == "coverity_scan" ]]; then
if [[ $COVERITY -eq 1 ]]; then
Expand Down Expand Up @@ -80,7 +80,7 @@ chmod a+w $HOST_WORKDIR
# - environment variables set (--env)
# - host directory containing the project source mounted (-v)
# - working directory set (-w)
sudo docker run --rm --privileged=true --name=$containerName $EXTRA_DOCKER_ARGS -i \
docker run --rm --privileged=true --name=$containerName $EXTRA_DOCKER_ARGS -i \
$ci_env \
--env http_proxy=$http_proxy \
--env https_proxy=$https_proxy \
Expand Down
2 changes: 1 addition & 1 deletion utils/docker/images/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fi
cp ../../../include/libsyscall_intercept_hook_point.h libsyscall_intercept_hook_point.h

# Build a Docker image tagged with ${DOCKERHUB_REPO}:OS-VER
sudo docker build -t $1:$2 \
docker build -t $1:$2 \
--build-arg http_proxy=$http_proxy \
--build-arg https_proxy=$https_proxy \
-f Dockerfile.$2 .
6 changes: 3 additions & 3 deletions utils/docker/images/push-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if [[ -z "$1" ]]; then
fi

# Check if the image tagged with ${DOCKERHUB_REPO}:OS-VER exists locally
if [[ ! $(sudo docker images -a | awk -v pattern="^${DOCKERHUB_REPO}:$1\$" \
if [[ ! $(docker images -a | awk -v pattern="^${DOCKERHUB_REPO}:$1\$" \
'$1":"$2 ~ pattern') ]]
then
echo "ERROR: wrong argument."
Expand All @@ -62,7 +62,7 @@ then
fi

# Log in to the Docker Hub
sudo docker login -u="${DOCKERHUB_USER}" -p="${DOCKERHUB_PASSWORD}"
docker login -u="${DOCKERHUB_USER}" -p="${DOCKERHUB_PASSWORD}"

# Push the image to the repository
sudo docker push ${DOCKERHUB_REPO}:$1
docker push ${DOCKERHUB_REPO}:$1
41 changes: 0 additions & 41 deletions utils/docker/prepare-environment.sh

This file was deleted.

2 changes: 1 addition & 1 deletion utils/docker/pull-or-rebuild-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ done

# Getting here means rebuilding the Docker image is not required.
# Pull the image from Docker Hub.
sudo docker pull ${DOCKERHUB_REPO}:$OS-$OS_VER
docker pull ${DOCKERHUB_REPO}:$OS-$OS_VER

0 comments on commit ab8a2b1

Please sign in to comment.