zoukankan      html  css  js  c++  java
  • linux 部署jenkins

    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了

  • 相关阅读:
    [Maven]自定义Archetypes
    [集合]LinkedList
    [集合]Arraylist
    [数据结构与算法]最长有效括号32
    [数据结构与算法]深度优先搜索dfs和广度优先搜索bfs
    [Vim] 光标移动到行首、行尾
    [数据结构与算法]给定一个链表,两两交换其中相邻的节点,并返回交换后的链表。
    [数据结构与算法]求给定二叉树的最小深度。最小深度是指树的根结点到最近叶子结点的最短路径上结点的数量。
    IDEA 自动设置compile target变成1.5
    【Java基础】sun.misc.BASE64和Java 8 java.util.Base64区别
  • 原文地址:https://www.cnblogs.com/hito/p/6123620.html
Copyright © 2011-2022 走看看