Skip to content

Commit 648cbe8

Browse files
committed
test(*): enable repeated runs of setup-node.sh script
1 parent e2c0689 commit 648cbe8

2 files changed

Lines changed: 70 additions & 26 deletions

File tree

contrib/aws/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
awscli==1.7.44
2+
boto==2.38.0
3+
docopt==0.6.2

tests/bin/setup-node.sh

Lines changed: 67 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,102 @@ set -eo pipefail
99
apt-get install -y apt-transport-https
1010

1111
# install docker
12-
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
13-
sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
14-
apt-get update && apt-get install -yq lxc-docker-1.5.0
12+
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 \
13+
--recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
14+
echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list
15+
apt-get update
16+
apt-get install -yq lxc-docker-1.5.0
17+
18+
# install extra extensions (AUFS)
19+
sudo apt-get -y install "linux-image-extra-$(uname -r)"
1520

1621
# install java
1722
apt-get install -yq openjdk-7-jre-headless
1823

24+
apt-get install -yq build-essential \
25+
libgl1-mesa-glx \
26+
libpython2.7 \
27+
libqt4-network \
28+
libqt4-opengl \
29+
libqtcore4 \
30+
libqtgui4 \
31+
libsdl1.2debian \
32+
libvpx1 \
33+
libxcursor1 \
34+
libxinerama1 \
35+
libxmu6 \
36+
psmisc
37+
1938
# install virtualbox
20-
apt-get install -yq build-essential libgl1-mesa-glx libpython2.7 libqt4-network libqt4-opengl \
21-
libqtcore4 libqtgui4 libsdl1.2debian libvpx1 libxcursor1 libxinerama1 libxmu6 psmisc
22-
wget -nv http://download.virtualbox.org/virtualbox/4.3.22/virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb
23-
dpkg -i virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb && \
24-
rm virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb
39+
if ! virtualbox --help &> /dev/null; then
40+
wget -nv http://download.virtualbox.org/virtualbox/4.3.22/virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb
41+
dpkg -i virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb
42+
rm virtualbox-4.3_4.3.22-98236~Ubuntu~raring_amd64.deb
43+
fi
2544

2645
# install vagrant
27-
wget -nv https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.deb
28-
dpkg -i vagrant_1.7.2_x86_64.deb && rm vagrant_1.7.2_x86_64.deb
46+
if ! vagrant -v &> /dev/null; then
47+
wget -nv https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.2_x86_64.deb
48+
dpkg -i vagrant_1.7.2_x86_64.deb
49+
rm vagrant_1.7.2_x86_64.deb
50+
fi
2951

3052
# install go
3153
wget -nv -O- https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | tar -C /usr/local -xz
3254
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
3355
echo "You must reboot for the global $PATH changes to take effect."
3456

3557
# install test suite requirements
36-
apt-get install -yq curl mercurial python-dev libffi-dev libpq-dev libyaml-dev git postgresql postgresql-client libldap2-dev libsasl2-dev
58+
apt-get install -yq curl \
59+
mercurial \
60+
python-dev \
61+
libffi-dev \
62+
libpq-dev \
63+
libyaml-dev \
64+
git \
65+
postgresql \
66+
postgresql-client \
67+
libldap2-dev \
68+
libsasl2-dev
69+
3770
curl -sSL https://raw.githubusercontent.com/pypa/pip/7.0.3/contrib/get-pip.py | python -
3871
pip install virtualenv
3972

73+
# TODO: rely on virtualenvs' pip instead of system pip on slaves
74+
pip install -r "contrib/aws/requirements.txt"
75+
4076
# Use cabal (Haskell installer) to build and install ShellCheck
41-
apt-get install -yq cabal-install
42-
cabal update
43-
cd /tmp
44-
git clone --branch v0.3.8 --single-branch https://github.com/koalaman/shellcheck.git
45-
cd shellcheck
46-
cabal install --global
47-
apt-get purge -yq cabal-install
77+
if ! shellcheck -V &> /dev/null; then
78+
apt-get install -yq cabal-install
79+
cabal update
80+
pushd /tmp
81+
git clone --branch v0.3.8 --single-branch https://github.com/koalaman/shellcheck.git
82+
pushd shellcheck
83+
cabal install --global
84+
popd +2
85+
apt-get purge -yq cabal-install
86+
fi
4887

4988
# create jenkins user and install node bootstrap script
50-
useradd -G docker,vboxusers -s /bin/bash --system -m jenkins
89+
if ! getent passwd | cut -d: -f1 | grep -q jenkins; then
90+
useradd -G docker,vboxusers -s /bin/bash --system -m jenkins
91+
fi
92+
5193
mkdir -p /home/jenkins/bin
5294
wget -nv -x -O /home/jenkins/bin/start-node.sh \
53-
https://raw.githubusercontent.com/deis/deis/master/tests/bin/start-node.sh
95+
https://raw.githubusercontent.com/deis/deis/master/tests/bin/start-node.sh
5496
chmod +x /home/jenkins/bin/start-node.sh
5597
chown -R jenkins:jenkins /home/jenkins/bin
5698

57-
# as the jenkins user, do "vagrant plugin install vagrant-triggers"
58-
su - jenkins -c "vagrant plugin install vagrant-triggers"
59-
60-
# TODO: instructions to download and install fleetctl
99+
# as the jenkins user, do "vagrant plugin install vagrant-triggers
100+
# if not already installed"
101+
su - jenkins -c "vagrant plugin list | grep -q vagrant-triggers || vagrant plugin install vagrant-triggers"
61102

62103
/etc/init.d/postgresql start
63104

64105
# set up PostgreSQL role for controller unit tests
65-
sudo -u postgres psql -c "CREATE ROLE jenkins WITH CREATEDB LOGIN;"
66-
sudo -u postgres psql -c "CREATE DATABASE deis WITH OWNER jenkins;"
106+
sudo -u postgres psql -c "CREATE ROLE jenkins WITH CREATEDB LOGIN;" || true
107+
sudo -u postgres psql -c "CREATE DATABASE deis WITH OWNER jenkins;" || true
67108
# edit postgresql.conf and change "fsync = off", then restart postgresql.
68109

69110
# now the jenkins user has to export some envvars to start as a node

0 commit comments

Comments
 (0)