-
Notifications
You must be signed in to change notification settings - Fork 7
/
runtest.sh
executable file
·64 lines (49 loc) · 1.31 KB
/
runtest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
JENKINS_CONTAINER=${JENKINS_CONTAINER:-jenkins}
cleanup() {
docker rm -f ${JENKINS_CONTAINER}
}
trap cleanup EXIT
set -e -u -x
PRIVILEGED=""
VOLUMES=""
# start docker container
if [[ "darwin" == "${OSTYPE//[0-9.]/}" ]]; then
PRIVILEGED="--privileged"
fi
docker run -d $PRIVILEGED --name jenkins jenkins/jenkins:2.426.3
docker inspect -f {{.State.Running}} jenkins
d=10
while ! docker logs jenkins 2>&1 | grep "Jenkins is fully up and running"
do sleep 10
d=$[$d -1]
if [ $d -lt 0 ]; then
exit 1
fi
done
JENKINS_ADDR=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' jenkins`
JENKINS_PORT=50000
ENV="-e JENKINS_PORT_8080_TCP_ADDR=${JENKINS_ADDR} -e JENKINS_PORT_8080_TCP_PORT=${JENKINS_PORT}"
MYPATH=`pwd`
VOLUMES="-v $MYPATH:/home/omero"
make start PORTS=$PRIVILEGED ENV="$ENV" VOLUMES="$VOLUMES"
docker inspect -f {{.State.Running}} devslave
SLAVE_ADDR=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' devslave`
d=10
while ! docker logs jenkins 2>&1 | grep "from /${SLAVE_ADDR}"
do sleep 10
d=$[$d -1]
if [ $d -lt 0 ]; then
exit 1
fi
done
# check permissions
docker exec devslave /bin/bash -c "sudo -u omero touch /home/omero/file"
if [ $(ls -ld file | awk '{print $3}') != $(whoami) ]; then
exit 1
fi
ls -al file
docker logs jenkins
# CLEANUP
make stop
make rm