jekins搭建

转自 https://www.cnblogs.com/hdwang/p/6081994.htmlhtml

==============================web

安装插件:算法

1 maven插件 2 tomcat自动部署插件  Deploy to container Plugin    shell

一 建立maven 项目apache

二 添加账号
  获取代码 1svn账号 2 tomcat部署账号  ubuntu

  Credentials->system->点击tomcat

Global credentials (unrestricted)

Add Credentials安全

填入UserName: deploy
password:deploy服务器

三 配置tomcat部署app

1 到你的tomcat,配置 tomcat-users.xml
配置角色

 <role rolename="manager-gui" />

 <role rolename="manager-script"/>

<user username="deploy" password="deploy" roles="manager-gui,manager-script"/>

2 webapps/manager/META-INF/context.xml

 去掉注释 

  <Valve className="org.apache.catalina.valves.RemoteAddrValve"

         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />

  不然会报错

===================

或着修改容许访问ip地址 allow="192.168.*.*" />  

===================

Jenkins发布报错:403/401 for URL: http://192.168.64.100:8080/manager/text/list

四 配置dev,test环境配置文件

参考 https://blog.csdn.net/huangchao064/article/details/73616320

1 在你的项目代码 ,配置开发,测试文件

    resources\env\dev\*.properties

    resources\env\test\*.properties

 

2  pom.xml增长 profiles

  

<profiles>

  <profile>

            <!-- 开发验证环境 -->

            <id>dev</id>

            <properties>

                <env>dev</env>

            </properties>

            <build>

                <resources>

                    <resource>

                        <directory>src/main/resources/env/${env}</directory>

                    </resource>

                    <resource>

                        <directory>src/main/resources</directory>

                    </resource>

                </resources>

            </build>

        </profile>

          <profile>

            <!-- 测试环境 -->

            <id>test</id>

            <properties>

                <env>test</env>

            </properties>

            <build>

                <resources>

                    <resource>

                        <directory>src/main/resources/env/${env}</directory>

                    </resource>

                    <resource>

                        <directory>src/main/resources</directory>

                    </resource>

                </resources>

            </build>

        </profile>

  </profiles>

3 pom.xml 增长

    <plugins>

        <plugin>

                <artifactId>maven-war-plugin</artifactId>

                <configuration>

                    <packagingExcludes>WEB-INF/classes/env/**</packagingExcludes>

                </configuration>

            </plugin>

  </plugins>

 

4 打包命令

这些配置完成后,就能够打包了。打包命令以下

clean -Ptest package

 

5 jenkins配置

clean install -Ptest

 

=============

配置权限

  若是须要分权限(安装Role-based Authorization Strategy插件)

1 安全配置==>受权策略=选择 Role-Based Strategy

2 系统管理 >> Manage and Assign Roles >>

3  Global roles 添加一个roles {zhihe只有Read,build}权限

  Project roles 添加一个role(Test-zhihe) Pattern(Test-zh.*) {只有Read}权限

4 给用户配角色 Assign Roles

 

===============================================

jenkins 远程执行shell脚本问题

JSch链接SSH问题Exception:Algorithm negotiation fail

(缘由: 远程服务器是ubuntun

http://www.lidaren.com/archives/1713

解决办法:
在SSH的配置文件
/etc/ssh/sshd_config
增长如下两行,让SSH支持相应的算法和MACs

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
 
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com,hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96

完成后重启SSH便可解决问题

相关文章
相关标签/搜索