2019獨角獸企業重金招聘Python工程師標準>>>
轉自 https://www.cnblogs.com/hdwang/p/6081994.html
==============================
安裝插件:
1 maven插件 2 tomcat自動部署插件??Deploy to container Plugin ? ?
一 創建maven 項目
二 添加帳號
? 獲取代碼 1svn帳號 2 tomcat部署帳號??
??Credentials->system->點擊
Global credentials (unrestricted) |
Add Credentials
填入UserName: deploy
password:deploy
三 配置tomcat部署
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-sha1MACs 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即可解決問題
?
?
? ?
?