forked from spotify/docker-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.sh
executable file
·71 lines (52 loc) · 1.61 KB
/
circle.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
65
66
67
68
69
70
71
#!/bin/bash -ex
case "$1" in
pre_machine)
# ensure correct level of parallelism
expected_nodes=2
if [ "$CIRCLE_NODE_TOTAL" -ne "$expected_nodes" ]
then
echo "Parallelism is set to ${CIRCLE_NODE_TOTAL}x, but we need ${expected_nodes}x."
exit 1
fi
# have docker bind to both localhost and unix socket
docker_opts='DOCKER_OPTS="$DOCKER_OPTS -D -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock --registry-mirror=http://localhost:5000"'
sudo sh -c "echo '$docker_opts' >> /etc/default/docker"
cat /etc/default/docker
;;
dependencies)
mvn clean install -Dmaven.javadoc.skip=true -DskipTests=true -B -V
docker pull registry
;;
test)
set +x
docker run -d -p 5000:5000 \
-e STANDALONE=false \
-e MIRROR_SOURCE=https://registry-1.docker.io \
-e MIRROR_SOURCE_INDEX=https://index.docker.io \
-e STORAGE_PATH=/registry \
-e AWS_KEY=$AWS_KEY \
-e AWS_SECRET=$AWS_SECRET \
-e AWS_REGION=us-east-1 \
-e AWS_BUCKET=spotify-docker-images \
-e SETTINGS_FLAVOR=s3 \
--name=registry \
registry
set -x
# expected parallelism: 2x. needs to be set in the project settings via CircleCI's UI.
case $CIRCLE_NODE_INDEX in
0)
# test with http
export DOCKER_HOST=tcp://127.0.0.1:2375
;;
1)
# test with unix sockets
export DOCKER_HOST=unix:///var/run/docker.sock
;;
esac
mvn test -B
;;
post_test)
docker logs registry &> $CIRCLE_ARTIFACTS/registry.log
cp target/surefire-reports/*.xml $CI_REPORTS
;;
esac