Repository navigation
Expand file tree
/
Copy pathconfig.sh
More file actions
executable file
·88 lines (73 loc) · 2.68 KB
/
Copy pathconfig.sh
File metadata and controls
executable file
·88 lines (73 loc) · 2.68 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
if [ ! -f /var/lib/jenkins/plugins ]
then
mkdir /var/lib/jenkins/plugins
chown jenkins:jenkins /var/lib/jenkins/plugins
fi
# download jenkins-cli.jar
RET=-1
until [ "$RET" -eq "0" ]
do
sleep 3
wget --no-proxy -O $INSTALL_DIR/bin/jenkins-cli.jar http://localhost:8080/jenkins/jnlpJars/jenkins-cli.jar
RET=$?
done
wget -O /tmp/default.js http://updates.jenkins-ci.org/update-center.json
# remove first and last line javascript wrapper
sed '1d;$d' /tmp/default.js > /tmp/default.json
# Now push it to the update URL
curl --noproxy localhost -X POST -H "Accept: application/json" -d @/tmp/default.json http://localhost:8080/jenkins/updateCenter/byId/default/postBack --verbose
# Jenkinsのプロキシ設定
if [ x"$http_proxy" != x"" ]
then
# set proxy. sorry IPv4 only and user:pass not supported...
proxyuser=`echo $http_proxy | sed -n 's/.*:\/\/\([a-zA-Z0-9]*\):.*/\1/p'`
proxypass=`echo $http_proxy | sed -n 's/.*:\/\/[a-zA-Z0-9]*:\([a-zA-Z0-9:]*\)\@.*/\1/p'`
echo
echo proxyuser=$proxyuser
echo proxypass=$proxypass
if [ x"$proxyuser" != x"" ]
then
http_proxy=`echo $http_proxy | sed "s/$proxyuser:$proxypass\@//"`
fi
proxyserver=`echo $http_proxy | cut -d':' -f2 | sed 's/\/\///g'`
proxyport=`echo $http_proxy | cut -d':' -f3 | sed 's/\///g'`
echo proxyserver=$proxyserver
echo proxyport=$proxyport
curl --noproxy localhost -X POST --data "json={\"name\": \"$proxyserver\", \"port\": \"$proxyport\", \"userName\": \"$proxyuser\", \"password\": \"$proxypass\", \"noProxyHost\": \"\"}" http://localhost:8080/jenkins/pluginManager/proxyConfigure --verbose
RET=$?
if [ "$RET" -ne "0" ]
then
echo "proxy setting for jenkins fail"
exit 1
fi
#service jenkins restart
fi
# プラグインインストール
mkdir tmp
pushd tmp
RET=-1
until [ "$RET" -eq "0" ]
do
sleep 3
java -jar $INSTALL_DIR/bin/jenkins-cli.jar -s http://localhost:8080/jenkins/ install-plugin reverse-proxy-auth-plugin
RET=$?
done
java -jar $INSTALL_DIR/bin/jenkins-cli.jar -s http://localhost:8080/jenkins/ install-plugin persona
java -jar $INSTALL_DIR/bin/jenkins-cli.jar -s http://localhost:8080/jenkins/ install-plugin git
java -jar $INSTALL_DIR/bin/jenkins-cli.jar -s http://localhost:8080/jenkins/ install-plugin redmine
java -jar $INSTALL_DIR/bin/jenkins-cli.jar -s http://localhost:8080/jenkins/ install-plugin dashboard-view
popd
rm -rf tmp
sleep 10
# persona-hudmi取得
if [ ! -d /var/lib/jenkins/persona ]
then
git clone https://github.com/okamototk/jenkins-persona-hudmi /var/lib/jenkins/persona
fi
if [ ! -f /var/lib/jenkins/config.xml ]
then
cp jenkins/config.xml /var/lib/jenkins/config.xml
fi
chown -R jenkins:jenkins /var/lib/jenkins/
service jenkins restart