jenkins 服务(分布式master+slave) 搭建
jenkins master war 被tomcat 解壓后(部署之后)的文件目錄:
[root@jenkissitweb204 CI]# cd jenkinsslave/ [root@jenkissitweb204 jenkinsslave]# [root@jenkissitweb204 jenkinsslave]# ll total 344 -rw-rw-r-- 1 jenkins jenkins 346845 Nov 23 10:37 slave.jar drwxrwxr-x 2 jenkins jenkins 4096 Nov 10 17:12 workspace [root@jenkissitweb204 jenkinsslave]# [root@jenkissitweb204 jenkinsslave]# [root@jenkissitweb204 jenkinsslave]# cd .. [root@jenkissitweb204 CI]# cd jenkinssonarprd/ [root@jenkissitweb204 jenkinssonarprd]# [root@jenkissitweb204 jenkinssonarprd]# ll total 500 -rw-r--r-- 1 root root 506256 Mar 31 2017 slave.jar drwxr-xr-x 2 root root 4096 Oct 20 09:16 workspace [root@jenkissitweb204 jenkinssonarprd]# cd .. [root@jenkissitweb204 CI]# cd jenkins [root@jenkissitweb204 jenkins]# [root@jenkissitweb204 jenkins]# [root@jenkissitweb204 jenkins]# ll total 240 -rw-rw-r-- 1 jenkins jenkins 603 Dec 1 15:51 au.com.rayh.GlobalConfigurationImpl.xml -rw-rw-r-- 1 jenkins jenkins 304 Dec 1 14:44 com.sic.plugins.kpp.provider.KPPKeychainsProvider.xml -rw-rw-r-- 1 jenkins jenkins 348 Dec 1 14:44 com.sic.plugins.kpp.provider.KPPProvisioningProfilesProvider.xml -rw-rw-r-- 1 jenkins jenkins 2371 Dec 1 15:51 config.xml -rw-rw-r-- 1 jenkins jenkins 12388 Nov 20 19:21 credentials.xml drwxrwxr-x 2 jenkins jenkins 4096 Nov 3 00:49 fingerprints -rw-rw-r-- 1 jenkins jenkins 889 Dec 1 15:51 hudson.maven.MavenModuleSet.xml -rw-rw-r-- 1 jenkins jenkins 159 Nov 30 10:05 hudson.model.UpdateCenter.xml -rw-rw-r-- 1 jenkins jenkins 335 Dec 1 15:51 hudson.plugins.android_emulator.AndroidEmulator.xml -rw-rw-r-- 1 jenkins jenkins 321 Dec 1 15:51 hudson.plugins.git.GitSCM.xml -rw-rw-r-- 1 jenkins jenkins 370 Dec 1 15:51 hudson.plugins.git.GitTool.xml -rw-rw-r-- 1 jenkins jenkins 1377 Dec 1 15:51 hudson.plugins.gradle.Gradle.xml -rw-rw-r-- 1 jenkins jenkins 467 Dec 1 15:51 hudson.plugins.msbuild.MsBuildBuilder.xml -rw-rw-r-- 1 jenkins jenkins 274 Dec 1 15:51 hudson.plugins.sonar.MsBuildSQRunnerInstallation.xml -rw-rw-r-- 1 jenkins jenkins 224 Dec 1 15:51 hudson.plugins.sonar.SonarGlobalConfiguration.xml -rw-rw-r-- 1 jenkins jenkins 203 Dec 1 15:51 hudson.plugins.sonar.SonarRunnerInstallation.xml -rw-rw-r-- 1 jenkins jenkins 473 Dec 1 15:51 hudson.scm.CVSSCM.xml -rw-rw-r-- 1 jenkins jenkins 4181 Dec 1 15:51 hudson.scm.SubversionSCM.xml -rw-rw-r-- 1 jenkins jenkins 337 Dec 1 15:51 hudson.tasks.Ant.xml -rw-rw-r-- 1 jenkins jenkins 188 Dec 1 15:51 hudson.tasks.Mailer.xml -rw-rw-r-- 1 jenkins jenkins 335 Dec 1 15:51 hudson.tasks.Maven.xml -rw-rw-r-- 1 jenkins jenkins 76 Dec 1 15:51 hudson.tasks.Shell.xml -rw-rw-r-- 1 jenkins jenkins 215 Dec 1 15:51 hudson.triggers.SCMTrigger.xml -rw------- 1 jenkins jenkins 1680 May 10 2016 identity.key.enc -rw-rw-r-- 1 jenkins jenkins 159 Dec 1 15:51 jenkins.model.ArtifactManagerConfiguration.xml -rw-rw-r-- 1 jenkins jenkins 138 Jul 11 2016 jenkins.model.DownloadSettings.xml -rw-rw-r-- 1 jenkins jenkins 270 Dec 1 15:51 jenkins.model.JenkinsLocationConfiguration.xml -rw-rw-r-- 1 jenkins jenkins 247 Dec 1 15:51 jenkins.mvn.GlobalMavenConfig.xml -rw-rw-r-- 1 jenkins jenkins 4101 Dec 1 15:51 jenkins.plugins.publish_over_ftp.BapFtpPublisherPlugin.xml -rw-rw-r-- 1 jenkins jenkins 169 Jul 11 2016 jenkins.security.QueueItemAuthenticatorConfiguration.xml drwxrwxr-x 643 jenkins jenkins 36864 Dec 4 12:46 jobs drwxrwxr-x 2 jenkins jenkins 4096 Mar 23 2017 kpp_upload drwxrwxr-x 4 jenkins jenkins 4096 May 10 2016 logs -rw-rw-r-- 1 jenkins jenkins 908 Nov 30 10:05 nodeMonitors.xml drwxrwxr-x 14 jenkins jenkins 4096 Dec 1 14:45 nodes -rw-rw-r-- 1 jenkins jenkins 255 Dec 1 15:51 org.jenkinsci.plugins.gitclient.JGitApacheTool.xml -rw-rw-r-- 1 jenkins jenkins 243 Dec 1 15:51 org.jenkinsci.plugins.gitclient.JGitTool.xml -rw-rw-r-- 1 jenkins jenkins 224 Dec 1 15:51 org.jvnet.hudson.plugins.port_allocator.PortAllocator.xml drwxrwxr-x 40 jenkins jenkins 4096 Nov 30 10:04 plugins -rw-rw-r-- 1 jenkins jenkins 129 Nov 30 10:05 queue.xml.bak -rw-rw-r-- 1 jenkins jenkins 64 May 10 2016 secret.key -rw-rw-r-- 1 jenkins jenkins 0 May 10 2016 secret.key.not-so-secret drwx------ 4 jenkins jenkins 4096 Jun 30 2016 secrets -rw-rw-r-- 1 jenkins jenkins 163 May 11 2016 sonar.xml drwxrwxr-x 2 jenkins jenkins 4096 May 10 2016 userContent drwxrwxr-x 47 jenkins jenkins 4096 Dec 2 17:41 users drwxrwxr-x 2 jenkins jenkins 4096 Nov 15 15:27 workspace [root@jenkissitweb204 jenkins]# 可見master 也是一臺slave 只是 多了jenkins war包。 [root@sncdpredb05 war]# ll 總用量 1836 -rw-r--r-- 1 root root 2824 7月 15 2015 ColorFormatter.class drwxr-xr-x 2 root root 4096 7月 15 2015 css -rw-r--r-- 1 root root 1544 7月 15 2015 dc-license.txt drwxr-xr-x 2 root root 4096 7月 15 2015 executable -rw-r--r-- 1 root root 17542 7月 15 2015 favicon.ico drwxr-xr-x 12 root root 4096 7月 15 2015 help drwxr-xr-x 6 root root 4096 7月 15 2015 images -rw-r--r-- 1 root root 1845 7月 15 2015 JNLPMain.class -rw-r--r-- 1 root root 788 7月 15 2015 LogFileOutputStream$1.class -rw-r--r-- 1 root root 586 7月 15 2015 LogFileOutputStream$2.class -rw-r--r-- 1 root root 2197 7月 15 2015 LogFileOutputStream.class -rw-r--r-- 1 root root 19577 7月 15 2015 Main.class -rw-r--r-- 1 root root 1049 7月 15 2015 MainDialog$1$1.class -rw-r--r-- 1 root root 1123 7月 15 2015 MainDialog$1.class -rw-r--r-- 1 root root 2424 7月 15 2015 MainDialog.class -rw-r--r-- 1 root root 512 7月 15 2015 Main$FileAndDescription.class drwxr-xr-x 3 root root 4096 7月 15 2015 META-INF -rw-r--r-- 1 root root 71 7月 15 2015 robots.txt drwxr-xr-x 3 root root 4096 7月 15 2015 scripts drwxr-xr-x 7 root root 4096 7月 15 2015 WEB-INF -rw-r--r-- 1 root root 1761676 7月 15 2015 winstone.jar [root@sncdpredb05 war]# cd ..mkdir -p /opt/CIPackage/ ? ? ? ?(安裝slave機器 直接 copy一些基礎軟件)
cd /usr
scp -r root@10.37.77.120:/usr/java ./
cd /usr/local
scp -r root@10.37.77.120:/usr/local/sonar ./
cd /opt
scp -r root@10.37.77.120:/opt/CI/ ./
cd /opt
scp -r root@10.37.77.120:/opt/CIPackage/ ./
CIPackage 目錄下面:
總用量 326840 drwxr-xr-x 2 root root 4096 5月 25 2015 examples -rw-r--r-- 1 root root 266089442 3月 20 2017 gitlab-ce-8.17.3-ce.0.el6.x86_64.rpm drwxr-xr-x 4 root root 4096 11月 29 2011 javadoc -rw-r--r-- 1 root root 68199289 8月 13 2015 jenkinssitold.war drwxr-xr-x 2 root root 4096 6月 12 2016 plugin drwxrwxr-x 6 1000 1000 4096 5月 8 2015 pytz-2014.4 drwxr-xr-x 5 sonar games 4096 5月 8 2015 requests-2.3.0 drwxrwxr-x 7 506 506 4096 5月 8 2015 setuptools-0.6c11 -rw-r--r-- 1 root root 340099 6月 9 2016 sonar.hpi drwxr-xr-x 3 root root 4096 8月 13 2015 Test -rw-r--r-- 1 root root 487 5月 25 2015 Test.class -rw-r--r-- 1 root root 140 5月 25 2015 Test.java [root@sncdpredb05 CIPackage]# cd p plugin/ pytz-2014.4/ [root@sncdpredb05 CIPackage]# cd plugin/ [root@sncdpredb05 plugin]# [root@sncdpredb05 plugin]# ll 總用量 3480 -rw-r--r-- 1 root root 133548 6月 12 2016 envinject.hpi -rw-r--r-- 1 root root 3003464 6月 12 2016 jquery.hpi -rw-r--r-- 1 root root 419614 6月 12 2016 sonar.hpi [root@sncdpredb05 plugin]#
usr/local/sonar 目錄:
slave 上進行安裝 maven?
總用量 48 drwxr-xr-x. 2 root root 4096 6月 28 2011 bin drwxr-xr-x. 2 root root 4096 6月 28 2011 etc drwxr-xr-x. 2 root root 4096 6月 28 2011 games drwxr-xr-x 6 root root 4096 10月 27 13:20 git drwxr-xr-x. 2 root root 4096 6月 28 2011 include drwxr-xr-x. 2 root root 4096 6月 28 2011 lib drwxr-xr-x. 2 root root 4096 6月 28 2011 lib64 drwxr-xr-x. 2 root root 4096 6月 28 2011 libexec drwxr-xr-x. 2 root root 4096 6月 28 2011 sbin drwxr-xr-x. 5 root root 4096 5月 4 2014 share drwxr-xr-x 3 root root 4096 12月 19 2016 sonar drwxr-xr-x. 2 root root 4096 6月 28 2011 src [root@sncdpreapp60 local]# cd sonar [root@sncdpreapp60 sonar]# [root@sncdpreapp60 sonar]# [root@sncdpreapp60 sonar]# ll 總用量 5032 drwxr-xr-x 6 root root 4096 12月 19 2016 apache-maven-3.0.5 -rw-r--r-- 1 root root 5144659 12月 19 2016 apache-maven-3.0.5-bin.tar.gz [root@sncdpreapp60 sonar]#然后是一些軟件工具安裝如 svn, git, node 以及用戶名和密碼的存儲
安裝svn 并記錄 用戶名密碼
yum install subversion
yum install apr-util
yum install openssl
cd /opt/CI
svn log -r head https://a.svncode.cnsuning.com/svn/myproject --username svnadmin --password ******
svn log -r head https://b.svncode.cnsuning.com/svn/myproject --username svnadmin --password ******
svn log -r head https://c.svncode.cnsuning.com/svn/myproject --username svnadmin --password ******
svn log -r head https://d.svncode.cnsuning.com/svn/myproject --username svnadmin --password ******
svn log -r head https://e.svncode.cnsuning.com/svn/myproject --username svnadmin --password ******
svn log -r head https://f.svncode.cnsuning.com/svn/myproject --username svnadmin --password ******
svn log -r head https://g.svncode.cnsuning.com/svn/myproject --username svnadmin --password ******
svn log -r head https://h.svncode.cnsuning.com/svn/myproject --username svnadmin --password ******
npm環境變量設置:
進入每臺進去,安裝node,解壓即可
rm -rf /opt/CI/node-v6.9.1-linux-x64
tar -zxvf /opt/CI/node-v6.9.1-linux-x64.tar.gz
vi ~/.npmrc
#registry=http://10.37.55.28:4873/
registry=http://snpm.cnsuning.com/
git安裝:
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
進入git解壓目錄
rm -rf /opt/CIPackage/git-2.10.2
tar -zxvf /opt/CIPackage/git-2.10.2.tar.gz
cd /opt/CIPackage/git-2.10.2
make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install
soa jar包特殊操作
cd /
mkdir -p /data/jenkins_node/workspace
10.27.88.40? root ******
scp -r root@10.27.88.40:/opt/jenkinsslave/workspace/soa_jar /data/jenkins_node/workspace/
設置環境變量:
vim /etc/profile
source /etc/profile
vim ~/.bashrc
export JAVA_HOME=/usr/java/jdk1.7.0_75 export PATH=$JAVA_HOME/bin:$PATH export MAVEN_HOME=/usr/local/sonar/apache-maven-3.0.5 export PATH=$MAVEN_HOME/bin:$PATH export ANT_HOME=/opt/CI/apache-ant-1.9.4 export PATH=$ANT_HOME/bin:$PATH export LANG="zh_CN.UTF-8" export NODE_HOME=/opt/CI/node-v6.9.1-linux-x64export PATH=$PATH:$NODE_HOME/bin/ export GULP_HOME=/opt/CI/node-v6.9.1-linux-x64/lib/node_modules/gulp export PATH=$PATH:$GULP_HOME/bin/ export MAVEN_OPTS="-Dfile.encoding=UTF-8 -XX:NewSize=128m -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps" export PATH=/usr/local/git/bin:$PATH ~
source ~/.bashrc
總結
以上是生活随笔為你收集整理的jenkins 服务(分布式master+slave) 搭建的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html是什么意思?
- 下一篇: sonar-scanner debug