summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2017-06-22 13:29:06 -0700
committerGary Wu <gary.i.wu@huawei.com>2017-06-22 13:29:06 -0700
commitb2076ffbf0ee9ad589a37bad8e12dcd64661b713 (patch)
tree3feabdf4a818ac5881e8a2ceabe1e6ff48f52cc4 /bootstrap
parent7c203d3202eb75493e2d2218b015f114cd14f025 (diff)
Refactoring
Change-Id: I6fdd372db4d8856853eb045033bd9dfbdcbea160 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap/jenkins/vagrant/bootstrap.sh25
-rwxr-xr-xbootstrap/jenkins/vagrant/jenkins-init-1.sh4
-rwxr-xr-xbootstrap/jenkins/vagrant/jenkins-init-2.sh2
-rwxr-xr-xbootstrap/jenkins/vagrant/jjb-init.sh4
4 files changed, 23 insertions, 12 deletions
diff --git a/bootstrap/jenkins/vagrant/bootstrap.sh b/bootstrap/jenkins/vagrant/bootstrap.sh
index f428cc1ff..7c7fe5eb2 100755
--- a/bootstrap/jenkins/vagrant/bootstrap.sh
+++ b/bootstrap/jenkins/vagrant/bootstrap.sh
@@ -1,7 +1,20 @@
-#!/bin/sh
+#!/bin/bash
+
+function restart_jenkins() {
+ sudo systemctl restart jenkins
+ sleep 1
+ echo -n "Restarting jenkins"
+ until $(curl --output /dev/null --silent --head --fail http://localhost:8080/login); do
+ printf '.'
+ sleep 3
+ done
+ echo
+ sleep 1
+}
sed -i 's|archive\.ubuntu\.com|mirrors.ocf.berkeley.edu|g' /etc/apt/sources.list
+# Assume that the vagrant host is running a local Nexus proxy
echo "192.168.33.1 nexus-proxy" >> /etc/hosts
@@ -15,8 +28,8 @@ EOF
apt-get update
apt-get -y install git
-git config --global user.email "gary.i.wu@huawei.com"
-git config --global user.name "Gary Wu"
+git config --global user.email "jenkins@localhost"
+git config --global user.name "jenkins"
apt-get -y install curl openjdk-8-jdk maven unzip
# install Jenkins
@@ -31,13 +44,11 @@ sudo usermod -aG docker jenkins
su -l jenkins -c "/vagrant/jenkins-init-1.sh"
-sudo systemctl restart jenkins
-sleep 10
+restart_jenkins
su -l jenkins -c "/vagrant/jenkins-init-2.sh"
-sudo systemctl restart jenkins
-sleep 10
+restart_jenkins
su -l jenkins -c "/vagrant/jjb-init.sh"
diff --git a/bootstrap/jenkins/vagrant/jenkins-init-1.sh b/bootstrap/jenkins/vagrant/jenkins-init-1.sh
index 776f2db73..104f040c2 100755
--- a/bootstrap/jenkins/vagrant/jenkins-init-1.sh
+++ b/bootstrap/jenkins/vagrant/jenkins-init-1.sh
@@ -13,7 +13,7 @@ EOF
git init
git add -A
-git commit -m 'Initial installation config'
+git commit -m 'Initial installation config' > /dev/null
mkdir -p ~/.m2
cp /vagrant/settings.xml ~/.m2
@@ -22,5 +22,5 @@ rm -rf users/admin
rsync -avP /vagrant/jenkins/ .
git add -A
-git commit -m 'Set up jenkins user'
+git commit -m 'Set up jenkins user' > /dev/null
diff --git a/bootstrap/jenkins/vagrant/jenkins-init-2.sh b/bootstrap/jenkins/vagrant/jenkins-init-2.sh
index eb0efe6b9..0c5dd9950 100755
--- a/bootstrap/jenkins/vagrant/jenkins-init-2.sh
+++ b/bootstrap/jenkins/vagrant/jenkins-init-2.sh
@@ -11,5 +11,5 @@ java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins instal
java -jar jenkins-cli.jar -s http://localhost:8080/ -auth jenkins:jenkins install-plugin envinject
git add -A
-git commit -m 'Install initial plugins'
+git commit -m 'Install initial plugins' > /dev/null
diff --git a/bootstrap/jenkins/vagrant/jjb-init.sh b/bootstrap/jenkins/vagrant/jjb-init.sh
index a37168d84..5f32dbb85 100755
--- a/bootstrap/jenkins/vagrant/jjb-init.sh
+++ b/bootstrap/jenkins/vagrant/jjb-init.sh
@@ -2,7 +2,7 @@
cd ~jenkins
git add -A
-git commit -m 'Installed plugins, restarted Jenkins'
+git commit -m 'Installed plugins, restarted Jenkins' > /dev/null
mkdir -p ~/.config/jenkins_jobs
@@ -21,5 +21,5 @@ logs/
EOF
git add -A
-git commit -m 'Set up initial jobs'
+git commit -m 'Set up initial jobs' > /dev/null