-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigureJenkins.sh
More file actions
executable file
·43 lines (31 loc) · 1.55 KB
/
Copy pathconfigureJenkins.sh
File metadata and controls
executable file
·43 lines (31 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash -l
echo -en '#Configuring Jenkins VM \n\n'
workdir=`pwd`
echo -en 'Work Directory of Jenkins VM is set to ' $workdir
#sed -i "s#workDir=.*#workDir=${workdir}#g" SparkBuildRunnableDist.xml
echo -en '\n\n'
#sed -i '/workdir=/d' ./installer.properties
#echo -e '\nworkdir='${workdir}'\n' >> installer.properties
echo -en '#Configuring PPA and Installing Jenkins\n\n'
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo -S sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo -S apt-get update
sudo -S apt-get -y install jenkins
echo -en '#Waiting to get Jenkins service up after installation \n\n'
sleep 20s
echo -en '#Getting CLI jar\n\n'
rm -rf jenkins-cli.jar*
wget http://localhost:8080/jnlpJars/jenkins-cli.jar
echo -en '#Setting up number of Jenkins Executors as per installer.properties\n\n'
numExec=$(grep -Po '(?<=numExecutors=).*' installer.properties)
sed -i "/numExecutors/c\ <numExecutors>${numExec}</numExecutors>" /var/lib/jenkins/config.xml
echo -en 'Number of Executors set in Jenkins = ' $numExec '\n\n'
echo -en '#Removing useSecurity tag from Jenkins config.xml to remove authentication \n\n'
ex +g/useSecurity/d +g/authorizationStrategy/d -scwq /var/lib/jenkins/config.xml
sudo -S /etc/init.d/jenkins restart
echo -en 'Restarting Jenkins Service to make changes effective \n\n'
sleep 10s
#java -jar jenkins-cli.jar -noKeyAuth -s http://localhost:8080/ safe-restart
#echo -en '#Waiting to get Jenkins Server up after restart\n'
chmod +x createJobs
exit 0