File tree 2 files changed +43
-4
lines changed
2 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,9 @@ ALLOW_STOP=0 # Use Web UI or allow "docker stop <container>"
30
30
HTTP_PORT=\$ {HTTP_PORT:-8010}
31
31
SLAVE_PORT=\$ {SLAVE_PORT:-9989}
32
32
33
- OPTS=" \$ DOCKER_OPTS --name \$ {CONTAINER}"
34
-
35
- [[ -z \$ CONTAINER_HOSTNAME ]] || OPTS=" \$ OPTS --hostname \$ CONTAINER_HOSTNAME"
33
+ . docker_utils.sh # updates OPTS variable
34
+ docker_mount_add credentials/htpasswd /etc/buildbot/htpasswd ro
35
+ docker_mount_finalize || exit 1
36
36
37
37
create_container() {
38
38
docker create -it \\
@@ -41,7 +41,6 @@ create_container() {
41
41
-p \$ {SLAVE_PORT}:9989 \\
42
42
-v \$ {P}:/app \\
43
43
-v \$ {P}_data/master:/data \\
44
- -v \$ {P}/credentials/htpasswd:/etc/buildbot/htpasswd:ro \\
45
44
\$ {IMAGE}
46
45
}
47
46
EOF
Original file line number Diff line number Diff line change
1
+ # Don't use this as a standalone script
2
+
3
+ OPTS=" $DOCKER_OPTS --name ${CONTAINER} "
4
+ [[ -z $CONTAINER_HOSTNAME ]] || OPTS=" $OPTS --hostname $CONTAINER_HOSTNAME "
5
+
6
+ # Reset file
7
+ echo " #!/bin/bash" > " .update_docker_mount.sh"
8
+ chmod +x " .update_docker_mount.sh"
9
+
10
+ # There are several issues with mounting of configuration files into container.
11
+ # One of them is related to files "update" problem with live container (without container re-creation).
12
+ # Tools (ansible, vim) usually creates new file and then rename it "atomically" (this assigns new "inode" to file).
13
+ # Docker binds "inode", not a file name, so that changes are not updated in the container.
14
+ # Workaround is mounting file "clones" instead of original files.
15
+ docker_mount_add ()
16
+ {
17
+ SRC=" ${P} /$1 "
18
+ DST=$2
19
+ if [[ " x$DST " == " x" ]]; then
20
+ DST=" /opt/pullrequest/$1 "
21
+ fi
22
+ MODE=${3}
23
+ if [[ " x$MODE " != " x" ]]; then
24
+ MODE=" :${MODE} "
25
+ fi
26
+
27
+ if [[ -f " $SRC " ]]; then
28
+ DOCKER_SRC=" ${P} /.docker/$1 "
29
+ DIR=$( dirname " ${DOCKER_SRC} " )
30
+ echo " mkdir -p $DIR " >> " .update_docker_mount.sh"
31
+ echo " cp -p \" $SRC \" \" ${DOCKER_SRC} \" " >> " .update_docker_mount.sh"
32
+ SRC=" ${DOCKER_SRC} "
33
+ fi
34
+ OPTS=" $OPTS -v ${SRC} :${DST}${MODE} "
35
+ }
36
+
37
+ docker_mount_finalize ()
38
+ {
39
+ . .update_docker_mount.sh || exit 1
40
+ }
You can’t perform that action at this time.
0 commit comments