A continuous integration method and device

Through a new continuous integration method and device, Jenkins tools cannot meet the problem that Jenkins tools cannot meet when facing complex React Native integration and high availability requirements, achieving multiple version control React Native continuous integration under high availability and security conditions.

CN113760305BActive Publication Date: 2025-04-15BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010952502.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-11
Publication Date
2025-04-15
Estimated Expiration
2040-09-11

AI Technical Summary

Technical Problem

Existing Jenkins continuous integration tools are not met when faced with complex React Native integration scenarios and high availability requirements.

Method used

A continuous integration method and device are provided that enables the implementation of React Native continuous integration with multiple versions under the premise of high availability and security. The method includes receiving integration requests, assembling integration objects and queuing them, downloading and decompressing code packages, integrating and compressing platform files, and uploading results.

Benefits of technology

The continuous integration of multiple version control React Native under high availability and security conditions is implemented, solving the problem of high availability and complex integration scenarios that Jenkins tools cannot meet.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760305B_ABST
    Figure CN113760305B_ABST
Patent Text Reader

Abstract

The present application provides a continuous integration method and device, the method comprising: when receiving an integration request, assembling the request content carried in the integration request into an integration object and storing it in an integration queue; when reading an integration object from the integration queue, using the download address in the integration object to download the code package, and decompressing N folders into the integration working directory; wherein N is the number of configured React Native versions; obtaining the SDK compressed package, and decompressing the SDK compressed package into the N folders according to the SDK version number; integrating and compressing the specified platform files for the N folders respectively; uploading the compressed platform files according to the upload address in the integration object. The method can realize continuous integration of React Native with multiple version controls under the premise of high availability and security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to a continuous integration method and device. Background Art

[0002] React Native is a cross-platform mobile application development framework that is currently widely used. After the framework is developed, the compilation and deployment method is to package it locally on the development computer through the bundle command tool provided by ReactNativeCli, compile it into jsbundle code files and related resources, and then deploy it to the Apple mobile device operating system (ios) or Android (android) client through the integrator in the app through hot update.

[0003] However, the method of using the development computer to compile is flawed. Different computer environment configurations and platforms will lead to different compilation results, bringing greater integration risks.

[0004] Currently, most development teams choose to deploy a continuous integration environment on a stable and reliable server for compiling tests, formal jsbundle packages and resource files.

[0005] The most popular continuous integration tool currently used is the Jenkins continuous integration tool based on the Java platform, which can be configured for React Native compilation.

[0006] In the process of implementing the present application, the inventors found that Jenkins, as a continuous inheritance tool for multiple platforms, could not meet the needs in the face of more complex ReactNative integration scenarios and high availability requirements. Summary of the invention

[0007] In view of this, the present application provides a continuous integration method and device, which can realize React Native continuous integration with multiple version controls under the premise of high availability and security.

[0008] To solve the above technical problems, the technical solution of this application is implemented as follows:

[0009] In one embodiment, a continuous integration method is provided, the method comprising:

[0010] When an integration request is received, the request content carried in the integration request is assembled into an integration object and stored in an integration queue;

[0011] When an integration object is read from the integration queue, the code package is downloaded using the download address in the integration object, and N folders are decompressed into the integration working directory; wherein N is the number of configured React Native versions;

[0012] Obtain the SDK compressed package, and decompress the SDK compressed package into the N folders according to the SDK version number;

[0013] Integrate and compress the specified platform files into the N folders respectively;

[0014] Upload the compressed platform file according to the upload address in the integration object.

[0015] In another embodiment, a continuous integration device is provided, the device comprising: a receiving unit, a first processing unit, a second processing unit, a third processing unit, an integration compression unit, and an uploading unit;

[0016] The receiving unit is used to receive an integration request;

[0017] The first processing unit is configured to, when the receiving unit receives an integration request, assemble the request content carried in the integration request into an integration object and store it in an integration queue; and read the integration object from the integration queue;

[0018] The second processing unit is configured to download a code package using a download address in the integration object and decompress N folders into an integration working directory when the first processing unit reads an integration object from the integration queue, wherein N is the number of configured React Native versions;

[0019] The third processing unit is used to obtain the SDK compressed package, and decompress the SDK compressed package into N folders in the second processing unit according to the SDK version number;

[0020] The integrated compression unit is used to integrate and compress the specified platform files in the N folders in the second processing unit respectively;

[0021] The uploading unit is used to upload the platform file compressed by the integrated compression unit according to the upload address in the integrated object in the first processing unit.

[0022] In another embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the continuous integration method when executing the program.

[0023] In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the continuous integration method are implemented.

[0024] As can be seen from the above technical solution, in the above embodiment, the integration request is assembled into a corresponding integration object, which is stored in the integration queue and waits for integration; when the integration object is integrated, the downloaded code package is unzipped into the same number of folders as the number of SDK versions, and the SDK compressed package is unzipped into the corresponding folder according to the version number, and the N files are integrated and the specified platform files are compressed and uploaded to the specified location. This solution can realize the continuous integration of React Native with multiple version control under the premise of high availability and security. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0026] Figure 1 This is a schematic diagram of the continuous integration process in Example 1 of the present application;

[0027] Figure 2 This is a schematic diagram of the continuous integration process in Example 2 of this application;

[0028] Figure 3 This is a schematic diagram of the structure of a device applied to the above technology in an embodiment of the present application;

[0029] Figure 4 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0031] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0032] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0033] A continuous integration method is provided in an embodiment of the present application and is applied to an integration device, wherein the integration device uses a Linux operating system and may be a server or a PC.

[0034] Embodiment 1

[0035] See also Figure 1 , Figure 1 This is a schematic diagram of the continuous integration process in Example 1 of this application. The specific steps are:

[0036] Step 101: when an integration request is received, the request content carried in the integration request is assembled into an integration object and stored in an integration queue.

[0037] In the specific implementation, an interface, such as an HTTP service interface, can be provided to implement the reception of integration requests. The specific implementation method can be: the distribution of solution requests implemented by the koa framework based on NodeJS and koa-router; and the method of receiving integration requests is not limited in the application embodiment.

[0038] When the continuous integration device in the embodiment of the present application receives an integration request, it first assembles the integration object according to the request and stores it in the integration queue, rather than directly integrating.

[0039] The request content carried in the integration request includes at least: a download address, a request identifier, and an upload address.

[0040] Among them, the download address is the storage address of the zip file compressed by the integrated code in the network space; the request identifier is used to uniquely identify an integration request; and the upload address is the address for uploading the integrated file to the network space.

[0041] The assembled integration object includes the download address, request identifier, and upload address.

[0042] The integration object is stored at the tail of the integration queue. When it is the turn of the integration object to be integrated, the integration object is taken out from the head of the integration queue for integration.

[0043] Step 102: when an integration object is read from the integration queue, a code package is downloaded using the download address in the integration object, and N folders are decompressed into the integration working directory.

[0044] Wherein, N is the number of configured React Native versions.

[0045] In the embodiment of the present application, several React Native versions of software development kits (sdk) are configured, and the code packages are unzipped into several folders.

[0046] If you configure two ReactNative versions of SDK, 0.55 and 0.59, then after the code package is downloaded, two folders will be decompressed and released to the packaging working directory.

[0047] Each folder can be named according to the following rules:

[0048] The concatenation of uuid, underscore, and version number.

[0049] This is just an example of a naming rule, and the specific implementation is not limited to the above naming rule.

[0050] After the code is unzipped, continue to unzip the SDK to the corresponding directory according to the corresponding version number.

[0051] Step 103, obtain the SDK compressed package, and decompress the SDK compressed package into the N folders according to the SDK version number.

[0052] The implementation of obtaining the SDK compression package in the embodiment of the present application specifically includes:

[0053] If it is determined that the SDK compressed package has been stored, directly obtain the stored SDK compressed package; otherwise, download the SDK compressed package through the interface provided by the server and store it.

[0054] In the embodiment of the present application, it can be set to obtain the SDK compressed package provided by the server when the device is started, or it can be obtained and stored when in use for subsequent continuous integration use.

[0055] Download the SDK compressed package through the interface provided by the server's koahttpserver.

[0056] The sdk compressed package includes N versions of sdk files, corresponding to the ReactNative versions. Each sdk compressed package mainly contains node_modules, package.json and other dependency files extracted from the project. In this way, the code project in the download integration request can omit the dependency installation during the integration process and directly install it by decompression. This can also prevent developers from introducing some risky dependencies.

[0057] Step 104, integrating and compressing the designated platform files into the N folders respectively.

[0058] The integration will call the execSync method of nodejs's child_process for each version's corresponding folder to execute the bundle integration capability of React Native Cli.

[0059] When the N folders are integrated separately, the N folders are sorted and integrated separately in a serial manner, but the sorting rule for sorting the N files is not limited.

[0060] If there are two folders, namely: Folder 1 and Folder 2, and they are sorted as: Folder 1, Folder 2, then after Folder 1 is integrated, Folder 2 is integrated.

[0061] The designated platform file can be set according to actual needs. Currently, common platform files include iOS platform files and Android platform files. Therefore, the designated platform file can be: iOS platform file, and / or Android platform file.

[0062] In this step, the N folders are respectively integrated and compressed with the specified platform files, including:

[0063] When the platform files are ios platform files and android platform files, the ios platform files are respectively integrated into the N folders in a serial manner, and the integrated ios platform files are compressed;

[0064] Integrating the Android platform files into the N folders in a serial manner respectively, and compressing the integrated iOS platform files;

[0065] When the platform file is an ios platform file, the ios platform files are respectively integrated into the N folders in a serial manner, and the integrated ios platform files are compressed;

[0066] When the platform file is an Android platform file, the Android platform files are respectively integrated into the N folders in a serial manner, and the integrated Android platform files are compressed.

[0067] During integration, for each version, that is, each folder, the execSync method of nodejs's child_process is used to execute ReactNativeCli's bundle integration capability, also known as packaging capability. The integrated platform file contains code and resource files. In order to better upload these contents, they are compressed into zip files as transmission objects.

[0068] Step 105: Upload the compressed platform file according to the upload address in the integration object.

[0069] In the embodiment of the present application, the integration request is assembled into a corresponding integration object, which is stored in the integration queue and waits for integration; when the integration object is integrated, the downloaded code package is unzipped into the same number of folders as the number of sdk versions, and the sdk compressed package is unzipped into the corresponding folder according to the version number, and the N files are integrated and the specified platform files are compressed and uploaded to the specified location. This solution can solve the problem that multiple version control, high availability of the integration server and service security cannot be met in React Native continuous integration, that is, it can realize React Native continuous integration with multiple version control under the premise of high availability and security.

[0070] Embodiment 2

[0071] In this embodiment, the main thread maintains the integration queue and the work task array; the sub-thread completes the integration of each integration transaction.

[0072] See also Figure 2 , Figure 2 This is a schematic diagram of the continuous integration process in Example 2 of this application. The specific steps are:

[0073] Step 201: When an integration request is received, the request content carried in the integration request is assembled into an integration object through the main thread and stored in the integration queue.

[0074] In the specific implementation, an interface, such as an HTTP service interface, can be provided to implement the reception of integration requests. The specific implementation method can be: the distribution of solution requests implemented by the koa framework based on NodeJS and koa-router; and the method of receiving integration requests is not limited in the application embodiment.

[0075] When the continuous integration device in the embodiment of the present application receives an integration request, it first assembles the integration object according to the request and stores it in the integration queue, rather than directly integrating.

[0076] The request content carried in the integration request includes at least: a download address, a request identifier, and an upload address.

[0077] Among them, the download address is the storage address of the zip file compressed by the integrated code in the network space; the request identifier is used to uniquely identify an integration request; and the upload address is the address for uploading the integrated file to the network space.

[0078] The assembled integration object includes the download address, request identifier, and upload address.

[0079] The integration object is stored at the tail of the integration queue. When it is the turn of the integration object to be integrated, the integration object is taken out from the head of the integration queue for integration.

[0080] Step 202 , determining through the main thread whether the number of ongoing integration transactions in the workTask array is less than M, if so, executing step 203 ; otherwise, executing step 202 .

[0081] In the specific implementation, the main thread maintains a workTask array, where users store the integration transactions being integrated.

[0082] The length of the workTask array can be used to determine the number of ongoing integration transactions.

[0083] M is the number of transactions integrated at the same time. It is set according to the actual application scenario and hardware capabilities during specific implementation.

[0084] To avoid integration failure, it can be set to 1. To improve integration efficiency, if the hardware allows, the value of M can be set larger.

[0085] Step 203, create a child thread through the main thread, take out an integration object from the integration queue, and add it to the workTask array as an integration transaction together with the information of the child thread; download the code package through the child thread using the download address in the integration object, and decompress N folders into the integration working directory.

[0086] The sub-thread is created and initialized. The initialization content includes: the PID, creation time and uuid of the sub-thread. The PID, creation time and uuid of the sub-thread are stored in the workTask array together with the integration object as the information of the sub-thread.

[0087] The child thread is integrated based on the fork of nodejs's child_process. The child thread is used to avoid the main thread's HTTP service and integration transactions becoming unresponsive due to excessive resource occupation by the integration, and the child thread itself becoming unresponsive and crashing, thus avoiding affecting the important functions of the main thread.

[0088] Wherein, N is the number of configured React Native versions.

[0089] In the embodiment of the present application, several React Native versions of SDK are configured, and the code package is unzipped into several folders.

[0090] If you configure two ReactNative versions of SDK, 0.55 and 0.59, then after the code package is downloaded, two folders will be decompressed and released to the packaging working directory.

[0091] Each folder can be named according to the following rules:

[0092] The concatenation of uuid, underscore, and version number.

[0093] This is just an example of a naming rule, and the specific implementation is not limited to the above naming rule.

[0094] After the code is unzipped, continue to unzip the SDK to the corresponding directory according to the corresponding version number.

[0095] Step 204: Obtain the SDK compressed package through the child thread, and decompress the SDK compressed package into the N folders according to the SDK version number.

[0096] The implementation of obtaining the SDK compression package in the embodiment of the present application specifically includes:

[0097] If it is determined that the SDK compressed package has been stored, directly obtain the stored SDK compressed package; otherwise, download the SDK compressed package through the interface provided by the server and store it.

[0098] In the embodiment of the present application, it can be set to obtain the SDK compressed package provided by the server when the device is started, or it can be obtained and stored when in use for subsequent continuous integration use.

[0099] Download the SDK compressed package through the interface provided by the server's koahttpserver.

[0100] The sdk compressed package includes N versions of sdk files. Each sdk compressed package mainly contains node_modules, package.json and other dependency files extracted from the project. In this way, the code project in the downloaded integration request can omit the dependency installation during the integration process and directly install it by decompression. This can also prevent developers from introducing some risky dependencies.

[0101] Step 205: Integrate and compress the designated platform files into the N folders respectively through the sub-thread.

[0102] When the N folders are integrated separately, the N folders are sorted and integrated separately in a serial manner, but the sorting rule for sorting the N files is not limited.

[0103] If there are two folders, namely: Folder 1 and Folder 2, and they are sorted as: Folder 1, Folder 2, then after Folder 1 is integrated, Folder 2 is integrated.

[0104] The designated platform file can be set according to actual needs. Currently, common platform files include iOS platform files and Android platform files. Therefore, the designated platform file can be: iOS platform file, and / or Android platform file.

[0105] In this step, the N folders are respectively integrated and compressed with the specified platform files, including:

[0106] When the platform files are ios platform files and android platform files, the ios platform files are respectively integrated into the N folders in a serial manner, and the integrated ios platform files are compressed;

[0107] Integrating the Android platform files into the N folders in a serial manner respectively, and compressing the integrated iOS platform files;

[0108] When the platform file is an ios platform file, the ios platform files are respectively integrated into the N folders in a serial manner, and the integrated ios platform files are compressed;

[0109] When the platform file is an Android platform file, the Android platform files are respectively integrated into the N folders in a serial manner, and the integrated Android platform files are compressed.

[0110] During integration, for each version, that is, each folder, the execSync method of nodejs's child_process is used to execute ReactNativeCli's bundle integration capability, also known as packaging capability. The integrated platform file contains code and resource files. In order to better upload these contents, they are compressed into zip files as transmission objects.

[0111] Step 206: Upload the compressed platform file according to the upload address in the integration object.

[0112] In the embodiment of the present application, the integration request is assembled into a corresponding integration object, which is stored in the integration queue and waits for integration; when the integration object is integrated, the downloaded code package is unzipped into the same number of folders as the number of sdk versions, and the sdk compressed package is unzipped into the corresponding folder according to the version number, and the N files are integrated and the specified platform files are compressed and uploaded to the specified location. This solution can solve the problem that multiple version control, high availability of the integration server and service security cannot be met in React Native continuous integration, that is, it can realize React Native continuous integration with multiple version control under the premise of high availability and security.

[0113] And the main thread and sub-thread are introduced to improve the integration efficiency.

[0114] Embodiment 3

[0115] In the second embodiment, integration is achieved through the main thread and the sub-thread. Failures may occur in many steps during the integration process, resulting in integration failure. This embodiment provides a processing flow when failure occurs.

[0116] When the child thread determines that any of the following situations occurs, the main thread is notified and the child thread is closed; the main thread clears the code package corresponding to the integration object, the corresponding file in the integration working directory and the information of the child thread, and takes the next integration object from the integration queue:

[0117] Failed to download the code package using the download address in the integration object, failed to decompress the code package, failed to decompress the SDK compressed package, the SDK file was incomplete, failed to integrate the platform file, failed to compress the platform file, failed to upload the compressed platform file, and successfully uploaded the compressed platform file.

[0118] If the integration queue is empty, the entire Integration Service enters a waiting state.

[0119] When the notification sent by the child thread is received, the processing process is the same, indicating that before the upload is successful, if the download of the code package using the download address in the integration object fails, the decompression of the code package fails, the decompression of the SDK compressed package fails, the SDK file is incomplete, the integration of the platform file fails, the compression of the platform file fails, the upload of the compressed platform file fails, etc., then an integration failure notification is sent to the main thread; when the compressed platform file is successfully uploaded, an integration success notification is sent.

[0120] During the specific implementation, the integration objects that are successfully integrated and those that fail to be integrated can be recorded so that the implementation personnel can check the integration status.

[0121] In this embodiment, when an integration transaction is integrated, no matter the integration succeeds or fails, the integrated sub-thread needs to notify the main thread, and the main thread cleans up all files related to the integration, which can save resources and improve integration efficiency.

[0122] Embodiment 4

[0123] The sub-threads used for integration contain a large number of operations that occupy a large amount of IO, CPU, and memory, so the thread itself is at risk of losing response, such as deadlock.

[0124] At the same time, if you encounter problems such as server restart or power outage, the ongoing packaging transaction will leave residual code and temporary packaging files in the system disk, which cannot be automatically cleaned up. Therefore, a maintenance transaction is required to perform regular maintenance on the integration service.

[0125] The specific implementation of integrated thread maintenance includes:

[0126] In the workTask array, the timestamp of the start of the integration transaction and the PID of the child thread are recorded by the main thread;

[0127] Determine the integration time of the sub-thread being integrated. If it is determined that the integration time of the sub-thread exceeds a preset threshold, close the sub-thread by using the PID of the sub-thread through the main thread, clear the code package corresponding to the integration object, the corresponding file in the integration working directory and the information of the sub-thread, and take the next integration object from the integration queue.

[0128] If the integration queue is empty, the entire Integration Service enters a waiting state.

[0129] In this embodiment, the ongoing integration transaction is maintained regularly to prevent an integration transaction from entering an infinite loop state, occupying a large amount of resources and reducing integration efficiency.

[0130] Embodiment 5

[0131] Configure the cleanup cycle;

[0132] When the cleanup cycle is over, clean up the system's temporary directory, downloaded code packages, and files in the integrated working directory.

[0133] In specific implementation, execSync can be used to call system commands to clean up related directories.

[0134] In a specific implementation, if the code package downloaded according to the integration object is stored in an integrated download directory, the integrated download directory can be directly cleaned up.

[0135] This embodiment performs regular cleaning for situations where the integration process is abnormal or the device is restarted and the integration-related files cannot be cleaned up normally, thereby saving system resources.

[0136] The integration service provided in the embodiment of the present application basically does not require maintenance and restart when the Linux system itself is stable. The integration time of a single version of each integration task can be controlled within about 2-3 minutes, which is very efficient.

[0137] Based on the same inventive concept, a continuous integration device is also provided in the embodiment of the present application. Figure 3 , Figure 3 This is a schematic diagram of the structure of a device applied to the above technology in an embodiment of the present application. The device includes: a receiving unit 301, a first processing unit 302, a second processing unit 303, a third processing unit 304, an integrated compression unit 305 and an uploading unit 306;

[0138] A receiving unit 301, configured to receive an integration request;

[0139] The first processing unit 302 is configured to, when the receiving unit 301 receives the integration request, assemble the request content carried in the integration request into an integration object and store it in an integration queue; and read the integration object from the integration queue;

[0140] The second processing unit 303 is configured to download a code package using a download address in the integration object when the first processing unit 302 reads an integration object from the integration queue, and decompress N folders into an integration working directory; wherein N is the number of configured React Native versions;

[0141] The third processing unit 304 is used to obtain the SDK compressed package, and decompress the SDK compressed package into N folders in the second processing unit 303 according to the SDK version number;

[0142] An integrated compression unit 305 is used to integrate and compress the specified platform files of the N folders in the second processing unit 303 respectively;

[0143] The uploading unit 306 is used to upload the platform file compressed by the integration compression unit 305 according to the upload address in the integration object in the first processing unit 302.

[0144] Preferably,

[0145] The third processing unit 304 is specifically used to obtain the SDK compressed package. If it is determined that the SDK compressed package has been stored, the stored SDK compressed package is directly obtained; otherwise, the SDK compressed package is downloaded through the interface provided by the server and stored.

[0146] Preferably,

[0147] The first processing unit 302 is specifically used to assemble the request content carried in the integration request into an integration object through the main thread and store it in the integration queue; determine through the main thread whether the number of ongoing integration transactions in the workTask array is less than M, if so, create a child thread, take out an integration object from the integration queue, and add it to the workTask array as an integration transaction together with the information of the child thread; otherwise, continue to wait; wherein M is the number of integration transactions set to be carried out simultaneously;

[0148] The second processing unit 303 is specifically configured to execute the operation of downloading the code package using the download address in the integration object and decompressing N folders into the integration working directory through the subthread created by the first processing unit 302 .

[0149] Preferably,

[0150] The second processing unit 303 is further used to notify the main thread and close the sub-thread when determining through the sub-thread that any of the following situations occurs: failure to download the code package using the download address in the integration object, failure to decompress the code package, failure to decompress the SDK compressed package, incomplete SDK file, failure to integrate the platform file, failure to compress the platform file, failure to upload the compressed platform file, and successful upload of the compressed platform file;

[0151] The first processing unit 302 is further used to clear the code package corresponding to the integration object, the corresponding file in the integration working directory, and the information of the sub-thread through the main thread when receiving the notification sent by the first processing unit 302 through the sub-thread, and take out the next integration object from the integration queue.

[0152] Preferably,

[0153] The first processing unit 302 is further used to record the timestamp of the start of the integration transaction and the PID of the child thread in the workTask array through the main thread; determine the integration time of the child thread being integrated, and if it is determined that the integration time of the child thread exceeds a preset threshold, close the child thread through the main thread using the PID of the child thread, clear the code package corresponding to the integration object, the corresponding file in the integration working directory and the information of the child thread, and take out the next integration object from the integration queue.

[0154] Preferably,

[0155] The integrated compression unit 305 is specifically used for integrating and compressing the specified platform files into the N folders respectively when the specified platform files are ios platform files and / or android platform files, including: when the platform files are ios platform files and android platform files, integrating the ios platform files into the N folders respectively in a serial manner, and compressing the integrated ios platform files; integrating the android platform files into the N folders respectively in a serial manner, and compressing the integrated ios platform files; when the platform files are ios platform files, integrating the ios platform files into the N folders respectively in a serial manner, and compressing the integrated ios platform files; when the platform files are android platform files, integrating the android platform files into the N folders respectively in a serial manner, and compressing the integrated android platform files.

[0156] Preferably, the device further comprises: a cleaning unit 307;

[0157] The cleaning unit 307 is used to configure a cleaning cycle; when the cleaning cycle is reached, the system's temporary directory, the downloaded code package in the second processing unit 303, and the files in the integrated working directory are cleaned up.

[0158] The units in the above-mentioned embodiments may be integrated into one body or deployed separately; they may be combined into one unit or further divided into multiple sub-units.

[0159] In another embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the continuous integration method when executing the program.

[0160] In another embodiment, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps in the continuous integration method can be implemented.

[0161] Figure 4 The following is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. Figure 4 As shown, the electronic device may include: a processor (Processor) 410, a communication interface (Communications Interface) 420, a memory (Memory) 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the following method:

[0162] When an integration request is received, the request content carried in the integration request is assembled into an integration object and stored in an integration queue;

[0163] When an integration object is read from the integration queue, the code package is downloaded using the download address in the integration object, and N folders are decompressed into the integration working directory; wherein N is the number of configured React Native versions;

[0164] Obtain the SDK compressed package, and decompress the SDK compressed package into the N folders according to the SDK version number;

[0165] Integrate and compress the specified platform files into the N folders respectively;

[0166] Upload the compressed platform file according to the upload address in the integration object.

[0167] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0168] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0169] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0170] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A continuous integration method, characterized in that: The method comprises: When an integration request is received, the request content carried in the integration request is assembled into an integration object and stored in an integration queue; When an integration object is read from the integration queue, the code package is downloaded using the download address in the integration object, and N folders are decompressed into the integration working directory; wherein N is the number of configured React Native versions; Obtain a software development kit sdk compressed package, and decompress the sdk compressed package into the N folders according to the sdk version number; Integrate and compress the specified platform files into the N folders respectively; Upload the compressed platform file according to the upload address in the integration object.

2. The method according to claim 1, characterized in that Get the SDK compressed package, including: If it is determined that the SDK compressed package has been stored, directly obtain the stored SDK compressed package; otherwise, download the SDK compressed package through the interface provided by the server and store it.

3. The method according to claim 1, characterized in that The method further comprises: Assembling the request content carried in the integration request into an integration object through the main thread and storing it in the integration queue; Determine through the main thread whether the number of ongoing integration transactions in the work task workTask array is less than M. If so, create a child thread, take out an integration object from the integration queue, and add it to the workTask array as an integration transaction together with the information of the child thread, and execute the steps of downloading the code package using the download address in the integration object and decompressing N folders to the integration working directory through the child thread; otherwise, continue to wait; wherein M is the number of integration transactions that are set to be carried out simultaneously.

4. The method according to claim 3, characterized in that The method further comprises: When the child thread determines that any of the following situations occurs, the main thread is notified and the child thread is closed; the main thread clears the code package corresponding to the integration object, the corresponding file in the integration working directory and the information of the child thread, and takes the next integration object from the integration queue: Failed to download the code package using the download address in the integration object, failed to decompress the code package, failed to decompress the SDK compressed package, the SDK file was incomplete, failed to integrate the platform file, failed to compress the platform file, failed to upload the compressed platform file, and successfully uploaded the compressed platform file.

5. The method according to claim 3, characterized in that: The method further comprises: In the workTask array, the timestamp of the start of the integration transaction and the PID of the child thread are recorded by the main thread; Determine the integration time of the sub-thread being integrated. If it is determined that the integration time of the sub-thread exceeds a preset threshold, close the sub-thread by using the PID of the sub-thread through the main thread, clear the code package corresponding to the integration object, the corresponding file in the integration working directory and the information of the sub-thread, and take the next integration object from the integration queue.

6. The method according to claim 1, characterized in that When the designated platform file is an iOS platform file of an Apple mobile device operating system and / or an Android platform file, the steps of integrating and compressing the designated platform files into the N folders respectively include: When the platform files are ios platform files and android platform files, the ios platform files are respectively integrated into the N folders in a serial manner, and the integrated ios platform files are compressed; the android platform files are respectively integrated into the N folders in a serial manner, and the integrated ios platform files are compressed; When the platform file is an ios platform file, the ios platform files are respectively integrated into the N folders in a serial manner, and the integrated ios platform files are compressed; When the platform file is an Android platform file, the Android platform files are respectively integrated into the N folders in a serial manner, and the integrated Android platform files are compressed.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Configure the cleanup cycle; When the cleanup cycle is over, clean up the system's temporary directory, downloaded code packages, and files in the integrated working directory.

8. A continuous integration device, characterized in that: The device comprises: a receiving unit, a first processing unit, a second processing unit, a third processing unit, an integrated compression unit and an uploading unit; The receiving unit is used to receive an integration request; The first processing unit is configured to, when the receiving unit receives an integration request, assemble the request content carried in the integration request into an integration object and store it in an integration queue; and read the integration object from the integration queue; The second processing unit is configured to download a code package using a download address in the integration object and decompress N folders into an integration working directory when the first processing unit reads an integration object from the integration queue, wherein N is the number of configured React Native versions; The third processing unit is used to obtain a software development kit sdk compressed package, and decompress the sdk compressed package into N folders in the second processing unit according to the version number of the sdk; The integrated compression unit is used to integrate and compress the specified platform files in the N folders in the second processing unit respectively; The uploading unit is used to upload the platform file compressed by the integrated compression unit according to the upload address in the integrated object in the first processing unit.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Performance test method, device and system based on cloud computing platform

    CN104461856A

  • Android installation package APK customizing method and device and server

    CN106843880A