blob: 7c7fe5eb25f2772079ad62a8450d4ca8df1a427b [file] [log] [blame]
Gary Wub2076ff2017-06-22 13:29:06 -07001#!/bin/bash
2
3function 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 Wu213a8352017-06-16 13:44:28 -070014
15sed -i 's|archive\.ubuntu\.com|mirrors.ocf.berkeley.edu|g' /etc/apt/sources.list
16
Gary Wub2076ff2017-06-22 13:29:06 -070017# Assume that the vagrant host is running a local Nexus proxy
Gary Wu213a8352017-06-16 13:44:28 -070018echo "192.168.33.1 nexus-proxy" >> /etc/hosts
19
20
21cat >> /etc/inputrc <<EOF
22set show-all-if-ambiguous on
23set show-all-if-unmodified on
24set match-hidden-files off
25set mark-symlinked-directories on
26EOF
27
28
29apt-get update
30apt-get -y install git
Gary Wub2076ff2017-06-22 13:29:06 -070031git config --global user.email "jenkins@localhost"
32git config --global user.name "jenkins"
Gary Wu213a8352017-06-16 13:44:28 -070033apt-get -y install curl openjdk-8-jdk maven unzip
34
35# install Jenkins
36wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
37sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
38apt-get update
39apt-get -y install jenkins jenkins-job-builder python-pip
40
41apt-get -y install docker.io
42sudo usermod -aG docker ubuntu
43sudo usermod -aG docker jenkins
44
45su -l jenkins -c "/vagrant/jenkins-init-1.sh"
46
Gary Wub2076ff2017-06-22 13:29:06 -070047restart_jenkins
Gary Wu213a8352017-06-16 13:44:28 -070048
49su -l jenkins -c "/vagrant/jenkins-init-2.sh"
50
Gary Wub2076ff2017-06-22 13:29:06 -070051restart_jenkins
Gary Wu213a8352017-06-16 13:44:28 -070052
53su -l jenkins -c "/vagrant/jjb-init.sh"
54