Jenkins mobile terminal CI actual combat

1. Background

The current release cycle of the client is once a week, which puts higher requirements on the continuous integration and delivery of the mobile terminal. It is necessary to quickly build a stable and reliable continuous integration and delivery system.

Second, the status quo

The double-ended packer uses a physical host connected to the company's LAN. Packing requires developers to log in to the packer and use the pack command to pack manually. It needs to go through packing and testing. If QA students report problems, they need to be repaired and then go through the process again. Package, test, and deliver the product until it passes the test. If there is a multi-branch packaging task, you need to wait for other students to complete it before you can use the packaging machine, and the process is very long.

3. Build a CI environment

After a series of program discussions, we decided to make some improvements on the basis of the existing infrastructure to complete a series of automation systems.
1. Connect the packaging machine with the previously built jenkins server, and use jenkins to complete the packaging work.
2. The test platform is connected to the jenkins api, and the packaging request is initiated through the platform.
The final process is:
platform --> jenkins --> packaging machine Execute the task --> package completed --> send notification
platform page
insert image description here

Plug-ins required for jenkins page
insert image description here
parametric build
insert image description here

Connect the baler

Connection method:
1. Use the intranet puncture method to forward the LAN of the packer to the public network to realize mutual access between the public network and the LAN Zhihu
tutorial: https://www.zhihu.com/question/50646943
cpolar official website: https: //dashboard.cpolar.com/get-started
Disadvantages: charges and speed limit, free version ip will change, and not safe, suitable for individual players, not suitable for building company-level services
2. Use gitlabci to connect to gitlab server and gitrunner Packer, this method does not need jenkins
3. Connect through jenkins sub-nodes, here you need to use the java-web method to set the sub-node connection method, one thing to note here is that the master node of jenkins must be on the public network server, The packer can only be used in the local area network

Here is the main demonstration of the third type:
jenkins configuration
insert image description here

jenkins build script

#!/bin/bash -l

sh jenkins路径/checkGit.sh -g [email protected]:iOS/ZQMusic.git
cd jenkins工作区/ZQMusic
sh updateShell.sh
sh .zqsh/publish.sh -p $JOB_NAME -c Profile -d $BUILD_ID -i com.zhenqu.music -b xx_3.68_bugfix -n "xxxx(Dev_3.62)"

Server scheduling code

Implement the Jenkins scheduling interface (including two implementation code examples of go and python)

Guess you like

Origin blog.csdn.net/weixin_43587784/article/details/129566645