码迷,mamicode.com
首页 > 系统相关 > 详细

linux 部署jenkins

时间:2016-12-02 01:08:48      阅读:390      评论:0      收藏:0      [点我收藏+]

标签:tar   global   XML   jenkins   security   pac   root   shel   dso   

1.安装jdk,配置jdk路径,python路径

(当前用户的配置文件)  vi .bash_profile

export JAVA_HOME=$HOME/local/jdk1.8.0_111
export TOMCAT_HOME=$HOME/local/apache-tomcat-7.0.72
PATH=$HOME/local/apache-ant-1.9.7/bin:$JAVA_HOME/bin:$HOME/local/python/bin:$HOME/local/mysql-5.1.58/bin:$PATH:$HOME/bin
LD_LIBRARY_PATH=$JAVA_HOME/lib:$HOME/local/python/lib:
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH
export LD_LIBRARY_PATH

2.安装tomcat,若非root权限用户,进入tomcat/bin目录下,修改sh文件权限

chmod 777 *.sh

3.安装jenkins,就是将jenkins.war放入tomcat/webapps目录下,另由于jenkins仅内部使用,修改登录安全限制

vi .jenkins/config.xml

<?xml version=‘1.0‘ encoding=‘UTF-8‘?>
<hudson>
  <disabledAdministrativeMonitors/>
  <version>1.609.3</version>
  <numExecutors>3</numExecutors>
  <mode>NORMAL</mode>
  <useSecurity>true</useSecurity>
  <authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>
  <securityRealm class="hudson.security.SecurityRealm$None"/>
  <disableRememberMe>false</disableRememberMe>
  <projectNamingStrategy class="jenkins.model.ProjectNamingStrategy$DefaultProjectNamingStrategy"/>
  <workspaceDir>${ITEM_ROOTDIR}/workspace</workspaceDir>
  <buildsDir>${ITEM_ROOTDIR}/builds</buildsDir>
  <jdks/>
  <viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
  <myViewsTabBar class="hudson.views.DefaultMyViewsTabBar"/>
  <clouds/>
  <quietPeriod>5</quietPeriod>
  <scmCheckoutRetryCount>0</scmCheckoutRetryCount>
  <views>
    <hudson.model.AllView>
      <owner class="hudson" reference="../../.."/>
      <name>All</name>
      <filterExecutors>false</filterExecutors>
      <filterQueue>false</filterQueue>
      <properties class="hudson.model.View$PropertyList"/>
    </hudson.model.AllView>
  </views>
  <primaryView>All</primaryView>
  <slaveAgentPort>0</slaveAgentPort>
  <label></label>
  <nodeProperties/>
  <globalNodeProperties/>
</hudson>

4.启动tomcat,访问jenkins

进入tomcat/bin目录下,执行 sh startup.sh,即启动完成

访问host/jenkins即可访问

技术分享

然后就可以创建自动化项目了

构建:Execute shell

source ~/.bash_profile
cd /home/user/local/testcase
pybot -L debug -d /home/user/local/testcase/case1

构建后操作:

......

坑记录:

我的自动化项目是用robot framework写的,结果报告在jenkins上打开,结果提示:

Opening Robot Framework report failed

技术分享

后来翻来覆去,放弃了tomcat,直接启动jenkins来解决:

后台启动jenkins:

nohup java -Dhudson.model.DirectoryBrowserSupport.CSP= -jar ./jenkins.war &

 再访问报告就OK了

linux 部署jenkins

标签:tar   global   XML   jenkins   security   pac   root   shel   dso   

原文地址:http://www.cnblogs.com/hito/p/6123620.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!