Record knowledge points and problem notes used by Jenkins

DingTalk plugin notification

The previous version of Jenkins was 2.264, and after installing the dingdingtalk plug-in, it cannot be displayed normally in the global settings. It should be caused by the incomplete display of the Android GUI interface. Version 2.263 and below can be used. So I can only go back to this version and use it normally.

Automatic scheduled build

H 8 * * *: Automatically build at 8 o'clock every day
Build once every 2 hours: HH/2 * * *
insert image description here
Build periodically: The task periodically builds the project, this is to trigger the build task at the specified time (regardless of the data in SVN Whether there is a change or not, a timed build is executed)

Poll SCM:
1. Poll SCM: Regularly check source code changes (according to the version number of the SCM software), if there is an update, checkout the latest code, and then execute the build action (poll SVN periodically to check whether there is any data change in SVN, if there is change, then execute the build task)
2. If I want to check the source code changes every 5 minutes, execute if there is a change

Clean up historical versions

insert image description here
Only the last 10 historical builds are kept for each build, and the historical builds are saved to the Jenkins installation directory on the C drive by default.

Record the packaging process through Jenkins

Previously, the company's version update process was to transfer the table first, then compile and package ab, then manually name ab, and then manually upload it to the CDN. Then let the user accept the increment by modifying the online parameter configuration. So I want to automate the steps of uploading Ab. The following is the recording process:

  • The first is the build process description,
    insert image description here
    Specific Construction Parameter Diagram
parameter name concrete action
ProjectPath Project Engineering Directory
excelChannel Specifically, to execute the table conversion tool, the specific logic is to default to the table directory under the upper-level directory of the project directory. Below, find all file names containing the two characters **<transfer table>** and return them in an array. The purpose That is, if the multi-channel table transfer tool is different, you only need to drop down and select the corresponding table transfer tool.
abVersion The ab resource version number, which controls the packaged ab name version.
LogVerbose Whether to print the log output by unity
isUploadAB Control whether it is necessary to automatically upload ab to CDN, so that it may only need to print ab out of the package, and there is no need to upload to CDN.
CDN_PATH [Account]:[Password]@[ip address]:[Port] /[AB storage directory] Example: cdnftp:cdnftp#[email protected]:6666/android/update This parameter depends on which upload tool is used. The company uses FileZilla. If you use the command line to upload, you need to bring the format like this.
isCopyCltSvrData Whether to copy client skills, levels, and battle DLLs to the battle server for submission.

The specific logic of the ProjectPath parameter is as follows:

def List = [];
List = ['D:/agame/trunk/android', 'D:/agame/jenkins_test/android'];
return List

The specific logic of the excelChannel parameter is as follows:

File pathFile = new File(ProjectPath  + "/GameUnity/Build/path.bat");
def reg = ~/PRODUCT_DATA_PATH=(.*)"/
def path = ""

pathFile.text.eachLine({
    
    line->
    def matcher = reg.matcher(line);
    def result = matcher.find()

    if(result)
    {
    
    
        path = matcher.group(1)
    }
})

if(path == "")
{
    
    
     tmpPath = ProjectPath  + "/../data"
     File tmpDataDir = new File(tmpPath);
     if(tmpDataDir.exists())
          path = tmpPath;
      else
          return ["path.bat未配置PRODUCT_DATA_PATH"]
}

def dataPath = path
File dir = new File(dataPath);

def names = [];
def regExcel = ~/.*转表.*bat/

dir.eachFile({
    
    file-> 
    def matcher = regExcel.matcher(file.name);
    def result = matcher.find()
    if(result)
        //names << file.name;
        names << file.getName().split("\\.")[0]
});

return names

The command line executed by the build process:

@echo OFF
@echo %ProjectPath%
%ProjectPath:~0,2%

set ext="/GameUnity/Build"
set build_path=%ProjectPath%%ext%

@echo %build_path%
cd %build_path%

call path.bat

python -u BuildJenkins.py
if %ERRORLEVEL% neq 0 exit

set buildType=0
REM echo packageType is:%packageType%
if "%packageType%"=="update" (
   set buildType=1
)

REM python -u BuildCore.py build %abVersion% %buildType%

if "%isCopyCltSvrData%"=="true" (
   python -u BuildCore.py copy_clt_svr_data
)

if "%isUploadAB%"=="true" (
   @echo 开始执行上传AB 
   cd uploadAB
   python -u UploadAb.py %abVersion%
)
  • The specific logic executes the core logic of BuildCore.py in the project Build directory.
  • After configuring Jenkin, you only need to enter parameters according to specific needs to start building. From packaging ab resources to uploading ab, it can be automated.

Guess you like

Origin blog.csdn.net/a525324105/article/details/111032648