|
3 | 3 | set -e |
4 | 4 | set -x |
5 | 5 |
|
| 6 | +TAG=test |
| 7 | + |
| 8 | +# before_install |
| 9 | +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| 10 | +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
| 11 | +sudo apt-get update |
| 12 | +sudo apt-get -y install docker-ce |
| 13 | + |
6 | 14 | # install |
7 | 15 | docker pull rastasheep/ubuntu-sshd:14.04 |
8 | 16 | docker pull busybox |
9 | 17 |
|
10 | 18 | #script |
11 | 19 |
|
12 | 20 | # make the plugin |
13 | | -make |
| 21 | +PLUGIN_TAG=$TAG make |
14 | 22 | # enable the plugin |
15 | | -make enable |
| 23 | +docker plugin enable vieux/sshfs:$TAG |
16 | 24 | # list plugins |
17 | 25 | docker plugin ls |
18 | 26 | # start sshd |
19 | 27 | docker run -d -p 2222:22 rastasheep/ubuntu-sshd:14.04 |
20 | 28 |
|
21 | 29 | # test1: simple |
22 | | -docker volume create -d vieux/sshfs:next -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume |
| 30 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o port=2222 -o password=root sshvolume |
23 | 31 | docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
24 | 32 | docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
25 | 33 | sudo cat /var/lib/docker/plugins/sshfs-state.json |
26 | 34 | docker volume rm sshvolume |
27 | 35 |
|
28 | 36 | # test2: allow_other |
29 | | -docker volume create -d vieux/sshfs:next -o sshcmd=root@localhost:/ -o allow_other -o port=2222 -o password=root sshvolume |
| 37 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o allow_other -o port=2222 -o password=root sshvolume |
30 | 38 | docker run --rm -v sshvolume:/write -u nobody busybox sh -c "echo hello > /write/world" |
31 | 39 | docker run --rm -v sshvolume:/read -u nobody busybox grep -Fxq hello /read/world |
32 | 40 | sudo cat /var/lib/docker/plugins/sshfs-state.json |
33 | 41 | docker volume rm sshvolume |
34 | 42 |
|
35 | 43 | # test3: compression |
36 | | -docker volume create -d vieux/sshfs:next -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume |
| 44 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume |
37 | 45 | docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
38 | 46 | docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
39 | 47 | sudo cat /var/lib/docker/plugins/sshfs-state.json |
40 | 48 | docker volume rm sshvolume |
41 | 49 |
|
42 | 50 | # test4: source |
43 | | -docker plugin disable vieux/sshfs:next |
44 | | -docker plugin set vieux/sshfs:next state.source=/tmp |
45 | | -docker plugin enable vieux/sshfs:next |
46 | | -docker volume create -d vieux/sshfs:next -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume |
| 51 | +docker plugin disable vieux/sshfs:$TAG |
| 52 | +docker plugin set vieux/sshfs:$TAG state.source=/tmp |
| 53 | +docker plugin enable vieux/sshfs:$TAG |
| 54 | +docker volume create -d vieux/sshfs:$TAG -o sshcmd=root@localhost:/ -o Ciphers=arcfour -o Compression=no -o port=2222 -o password=root sshvolume |
47 | 55 | docker run --rm -v sshvolume:/write busybox sh -c "echo hello > /write/world" |
48 | 56 | docker run --rm -v sshvolume:/read busybox grep -Fxq hello /read/world |
49 | 57 | sudo cat /tmp/sshfs-state.json |
|
0 commit comments