blob: fd0caf5c63256117b949f945b7e21168cde01b83 [file] [log] [blame]
Gary Wub2076ff2017-06-22 13:29:06 -07001#!/bin/bash
Gary Wu5cccfa92017-08-02 12:03:10 -07002#
3# Copyright 2017 Huawei Technologies Co., Ltd.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
Gary Wub2076ff2017-06-22 13:29:06 -070011
12function restart_jenkins() {
13 sudo systemctl restart jenkins
14 sleep 1
15 echo -n "Restarting jenkins"
16 until $(curl --output /dev/null --silent --head --fail http://localhost:8080/login); do
17 printf '.'
18 sleep 3
19 done
20 echo
21 sleep 1
22}
Gary Wu213a8352017-06-16 13:44:28 -070023
24sed -i 's|archive\.ubuntu\.com|mirrors.ocf.berkeley.edu|g' /etc/apt/sources.list
25
Gary Wub2076ff2017-06-22 13:29:06 -070026# Assume that the vagrant host is running a local Nexus proxy
Gary Wu213a8352017-06-16 13:44:28 -070027echo "192.168.33.1 nexus-proxy" >> /etc/hosts
28
29
30cat >> /etc/inputrc <<EOF
31set show-all-if-ambiguous on
32set show-all-if-unmodified on
33set match-hidden-files off
34set mark-symlinked-directories on
35EOF
36
37
38apt-get update
39apt-get -y install git
Gary Wub2076ff2017-06-22 13:29:06 -070040git config --global user.email "jenkins@localhost"
41git config --global user.name "jenkins"
Gary Wu213a8352017-06-16 13:44:28 -070042apt-get -y install curl openjdk-8-jdk maven unzip
43
44# install Jenkins
45wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
46sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
47apt-get update
48apt-get -y install jenkins jenkins-job-builder python-pip
49
50apt-get -y install docker.io
51sudo usermod -aG docker ubuntu
52sudo usermod -aG docker jenkins
53
54su -l jenkins -c "/vagrant/jenkins-init-1.sh"
55
Gary Wub2076ff2017-06-22 13:29:06 -070056restart_jenkins
Gary Wu213a8352017-06-16 13:44:28 -070057
58su -l jenkins -c "/vagrant/jenkins-init-2.sh"
59
Gary Wub2076ff2017-06-22 13:29:06 -070060restart_jenkins
Gary Wu213a8352017-06-16 13:44:28 -070061
62su -l jenkins -c "/vagrant/jjb-init.sh"
63