1, gitlab triggered automatically build jenkins
1⃣️ install plug-ins:
2⃣️ new construction, set git url, build when a change is pushed
auto.sh
/bin/sh echo "123456"
3⃣️gitlab - "Avatar -> settings -" Access Tokens create tokens: yxzwM2AxVxZFdr9uydx4
Click Add, add the token generated by step
After creating webhook, push test event test some clicks, you can manually generate an event, triggering jenkins engineering
Then click Edit, webhook bottom of the page to view the most recent call to the situation; Click to view details view details call case
Jenkins appear in the corresponding engineering construction history
When auto.sh modified, after submission (as long as the first step of the project have submitted 5⃣️ configuration), the project will automatically build
2, the graph view performance test
Construction of the test results [file] generate test reports: implementation of jmeter -g result.jtl -o reports /
After the build operation [publish performance test result report] - dependent plug performance plugin
[Build] immediately
3, jenkins parametric Construction
参数化构建:依赖插件(Extended Choice Parameter)
配置页面-参数化构建过程-增加Extended choice parameter
启动远程服务器命令(remote_startup.sh 传git)
#!/bin/sh IFS=',' remote_host_arr=($1) for host in ${remote_host_arr[@]} do pid=$(sshpass -p password ssh -Tq -p 9800 ceshi@$host "ps -ef | grep jmeter-server | grep -v grep | awk '{print $2}'"| awk '{print $2}'|xargs) sshpass -p password ssh -Tq -p 9800 ceshi@$host << remotessh sudo -s cd /usr/local/Jmeter/apache-jmeter-5.0/bin/ echo $pid echo ${#pid} if [ -n "$pid" ]; then kill -9 $pid fi export JAVA_HOME="/usr/local/soft/jdk8" nohup sh jmeter-server > nohup.out 2>&1 & exit remotessh done
4、Jenkins Run Performance test
(没有安装bzt,安装有virtualenv的情况-会先在虚拟环境安装bzt)
构建成功后,可查看测试报告<每次构建结果曲线图>,类似
5、jenkins集成多个git仓库
安装插件-Multiple SCMs
配置多个git地址
执行shell的时候指定正确的路径
参考资料
其它