Gary Wu | b2076ff | 2017-06-22 13:29:06 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | function restart_jenkins() { |
| 4 | sudo systemctl restart jenkins |
| 5 | sleep 1 |
| 6 | echo -n "Restarting jenkins" |
| 7 | until $(curl --output /dev/null --silent --head --fail http://localhost:8080/login); do |
| 8 | printf '.' |
| 9 | sleep 3 |
| 10 | done |
| 11 | echo |
| 12 | sleep 1 |
| 13 | } |
Gary Wu | 213a835 | 2017-06-16 13:44:28 -0700 | [diff] [blame] | 14 | |
| 15 | sed -i 's|archive\.ubuntu\.com|mirrors.ocf.berkeley.edu|g' /etc/apt/sources.list |
| 16 | |
Gary Wu | b2076ff | 2017-06-22 13:29:06 -0700 | [diff] [blame] | 17 | # Assume that the vagrant host is running a local Nexus proxy |
Gary Wu | 213a835 | 2017-06-16 13:44:28 -0700 | [diff] [blame] | 18 | echo "192.168.33.1 nexus-proxy" >> /etc/hosts |
| 19 | |
| 20 | |
| 21 | cat >> /etc/inputrc <<EOF |
| 22 | set show-all-if-ambiguous on |
| 23 | set show-all-if-unmodified on |
| 24 | set match-hidden-files off |
| 25 | set mark-symlinked-directories on |
| 26 | EOF |
| 27 | |
| 28 | |
| 29 | apt-get update |
| 30 | apt-get -y install git |
Gary Wu | b2076ff | 2017-06-22 13:29:06 -0700 | [diff] [blame] | 31 | git config --global user.email "jenkins@localhost" |
| 32 | git config --global user.name "jenkins" |
Gary Wu | 213a835 | 2017-06-16 13:44:28 -0700 | [diff] [blame] | 33 | apt-get -y install curl openjdk-8-jdk maven unzip |
| 34 | |
| 35 | # install Jenkins |
| 36 | wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - |
| 37 | sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' |
| 38 | apt-get update |
| 39 | apt-get -y install jenkins jenkins-job-builder python-pip |
| 40 | |
| 41 | apt-get -y install docker.io |
| 42 | sudo usermod -aG docker ubuntu |
| 43 | sudo usermod -aG docker jenkins |
| 44 | |
| 45 | su -l jenkins -c "/vagrant/jenkins-init-1.sh" |
| 46 | |
Gary Wu | b2076ff | 2017-06-22 13:29:06 -0700 | [diff] [blame] | 47 | restart_jenkins |
Gary Wu | 213a835 | 2017-06-16 13:44:28 -0700 | [diff] [blame] | 48 | |
| 49 | su -l jenkins -c "/vagrant/jenkins-init-2.sh" |
| 50 | |
Gary Wu | b2076ff | 2017-06-22 13:29:06 -0700 | [diff] [blame] | 51 | restart_jenkins |
Gary Wu | 213a835 | 2017-06-16 13:44:28 -0700 | [diff] [blame] | 52 | |
| 53 | su -l jenkins -c "/vagrant/jjb-init.sh" |
| 54 | |