Method for dynamically configuring multi-terminal applet based on jenkins
By performing parameterized configuration and automated construction in Jenkins, the problem of inefficient development and maintenance of multi-terminal applets is solved, and the unified dynamic configuration and stability guarantee of applets is achieved.
Patent Information
- Application Number
- CN202411542913.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-18
AI Technical Summary
The existing technology is inefficient in the development and maintenance of multi-end applets, requires excessive manual participation in construction, and there are unknown abnormal failures that may occur due to environmental differences.
Jenkins is used for parameterized configuration, dynamically configure the construction environment of multi-end applets. Through automated construction and upload interfaces, mini-program products are generated and uploaded to various applet platforms, display the preview code and upload to the version control system.
The unified dynamic configuration method of multi-end applets has been realized, which has significantly improved the efficiency of mini-application development, testing and operation and maintenance, reduced unknown exceptions that may occur due to differences in multi-end application environments, and ensured the stability of mini-applications.
Smart Images

Figure CN119473378A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of small program development, and in particular to a method for dynamically configuring multi-terminal small programs based on Jenkins. Background Art
[0002] The development of mini programs mainly uses technologies such as JavaScript, CSS, and WXML. Mini programs are applications that can be used without downloading and installing. They realize the dream of "apps at your fingertips". Users can open the application by scanning or searching. Mini programs are lightweight applications that do not require users to install additional software on their mobile phones. They can be accessed and used directly through specific platforms (such as WeChat, Alipay, Toutiao, etc.). The main features of mini programs are convenience, speed, and low cost. Users do not need to download and install, which saves mobile phone storage space; at the same time, mini programs load quickly and provide a smooth user experience. For developers, the development and maintenance costs of mini programs are relatively low. Therefore, mini programs are currently widely used on various platforms.
[0003] From the current development method, an application is generally developed for different application terminals. In the daily integrated development and deployment stage of multi-terminal mini-program business, too much manual participation is required for construction, which is inefficient. At the same time, there are unknown abnormal failures that may occur due to environmental differences. Jenkins is an open source automation server for continuous integration and continuous deployment (CI / CD). It can help developers build, test and deploy software. It aims to provide an open and easy-to-use software platform to enable continuous integration of software projects.
[0004] Through patent search, there are very few patents that use Jenkins to configure small programs. In the Internet search, there are a few introductions to configuring small programs through Jenkins. Although developing and publishing small programs through Jenkins can improve efficiency, there is no unified development and configuration method for multi-terminal small programs. The current method still affects the efficiency of small program development and maintenance. Summary of the invention
[0005] In view of the above problems, an object of the present invention is to provide a technical problem to be solved.
[0006] The present invention adopts the following technical solution:
[0007] The method for dynamically configuring multi-terminal applets based on Jenkins comprises the following steps:
[0008] Step S1, use Jenkins to perform parameterized configuration and specify the server and code branch that the mini-program build depends on;
[0009] Step S2: Trigger the build task by clicking build manually or automatically;
[0010] Step S3: Aggregate the mini program upload interfaces of various application-side manufacturers, call the CI build instructions of the corresponding manufacturers according to the parameterized configuration, generate the mini program product, and then call the corresponding manufacturer upload interface to upload the mini program product to the mini program platform, and the mini program platform generates a preview code;
[0011] Step S4: When Jenkins compiles, it dynamically displays the Mini Program preview code, so that developers can scan the preview code to experience and test the Mini Program.
[0012] Step S5: For different manufacturers, when Jenkins compilation is completed, the mini-program product is uploaded to the version control system of the corresponding mini-program platform for project review and release.
[0013] Furthermore, the specific process of step S1 is as follows:
[0014] Use the interface to create a new build task in Jenkins and dynamically configure parameterized builds, where the configured parameters include server address, server type, and code branch name.
[0015] Furthermore, in step S2, the automatic triggering of the build task is implemented as follows: by configuring a Webhook receiver for the Git code repository, when the Git repository triggers the Webhook, Jenkins automatically receives the notification and starts the corresponding build task according to the configuration trigger.
[0016] Furthermore, in step S3, the CI build instruction is a command line tool provided by the mini-program platform, or a custom script. By calling these CI build instructions, the mini-program product can be directly generated; in the process of uploading the mini-program product, additional information needs to be provided, and the additional information is dynamically transmitted through the parameter configuration of Jenkins; after uploading, the mini-program platform generates a preview code, Jenkins captures the preview code, and displays it to the user in the build log or interface.
[0017] Furthermore, in step S4, the mini-program preview code is automatically captured and displayed through a Jenkins plug-in or a custom script. For the custom script method, an HTML page containing the preview code is dynamically generated according to the manufacturer name and the preview code information returned by the upload interface, or the preview code is directly output in the Jenkins console.
[0018] Furthermore, the specific process of step S5 is as follows: build a script in Jenkins, call the interface of the version control system of the mini-program platform, upload the built mini-program product to the specified version branch, provide related information during the upload process, and dynamically transmit the related information through the parameter configuration of Jenkins. After the upload is successful, the operation and maintenance personnel operate the review process on each application platform.
[0019] The beneficial effects of the present invention are: in response to the business demands of multi-terminal mini-programs, the present invention utilizes the parameterized configuration function and dynamic configuration of Jenkins to automatically build mini-program products, forming a unified multi-terminal mini-program dynamic configuration method, which can significantly improve the mini-program development, testing and operation and maintenance efficiency, reduce unknown anomalies that may occur due to differences in multi-terminal application environments, and ensure the stability of the mini-program. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flow chart of a method for dynamically configuring multi-terminal applets based on Jenkins provided by an embodiment of the present invention;
[0021] Figure 2 It is a schematic diagram of the process interaction of the method of the embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0023] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.
[0024] like Figure 1 , 2 As shown, the method for dynamically configuring multi-terminal applets based on Jenkins provided in this embodiment includes the following steps:
[0025] Step S1: Use Jenkins to perform parameterized configuration and specify the server and code branch that the mini-program build depends on.
[0026] Jenkins is a kind of continuous integration tool developed by Java. As an automation tool, it is used as a continuous integration (CI) process, and the development and deployment efficiency can be improved by this tool. For small program development, different projects may depend on different server environments (such as development server, test server or production server), and may need to be built on different code branches. In order to realize this flexibility, the present invention utilizes the parameterized construction function of Jenkins to carry out parameterized configuration.
[0027] In the specific operation, first create a new build task in Jenkins through the interface and dynamically configure the parameterized build. The configuration parameters include server address, server type (such as development server, test server or production server), code branch name, etc. By operating on the user interface provided by Jenkins for dynamic configuration, select the specific server and code branch when triggering the build.
[0028] For example, for WeChat Mini Program, suppose you need to specify the "WeChat Mini Program server address" and "code branch" (such as "main branch master", "development branch dev", etc.). When triggering a build, users or developers can select the corresponding server and branch through the Jenkins interface to achieve dynamic configuration of the build environment. This approach not only improves the flexibility of the build, but also ensures that the build process is highly matched with project requirements.
[0029] Step S2: Trigger the build task by clicking build manually or automatically.
[0030] In Jenkins, there are many ways to trigger build tasks, including manual triggering and automatic triggering through Webhook. Generally, the manual triggering method is suitable for scenarios where the timing of the build needs to be manually controlled. Users only need to click the "Build" button in the Jenkins interface, and Jenkins will start the build task according to the previously configured parameters.
[0031] The automatic triggering method relies on the Webhook function of the Git code repository. Webhook allows the Git repository to send HTTP requests to the specified URL when specific events (such as code submission, merge request, etc.) occur.
[0032] In specific operations, by configuring a Webhook receiver for the Git code repository, when the Git repository triggers the Webhook, Jenkins automatically receives the notification and triggers the corresponding build task according to the configuration. When configuring the Webhook, you need to find the Webhook section in the Git repository settings and add a new Webhook. In the Webhook configuration, you need to fill in the Jenkins Webhook receiver URL, and you may need to make some additional settings (such as trigger conditions, authentication, etc.) according to the Jenkins configuration.
[0033] Step S3: Aggregate the mini-program upload interfaces of various application-side manufacturers, call the CI build instructions of the corresponding manufacturer according to the parameterized configuration, generate the mini-program product, and then call the corresponding manufacturer upload interface to upload the mini-program product to the mini-program platform, and the mini-program platform generates a preview code.
[0034] With the continuous development of the mini-program ecosystem, more and more platforms have launched their own mini-program platforms, such as WeChat, Alipay, Toutiao, etc. Each platform has its own mini-program upload interface and construction tools. The conventional development method is to use the construction tools of each platform for development. Due to the large number of platforms, this will lead to a lot of duplication of work. The present invention can be uniformly developed and released on multi-terminal mini-program platforms, and cross-platform mini-program construction and uploading can be realized in Jenkins. This step requires the aggregation and unified management of the interfaces of these platforms.
[0035] According to the parameters configured in step S1, such as the manufacturer name, server address, etc., the CI build instructions of the corresponding manufacturer are dynamically selected and called to directly generate the mini-program product (such as code package, resource file, etc.). The CI build instructions can be a command line tool provided by the platform or a custom script. By calling these CI build instructions, the mini-program product is generated.
[0036] After the mini program product is generated, the corresponding manufacturer upload interface is called to upload the mini program product to the mini program platform, and the mini program platform generates a preview code. During the upload process, some additional information needs to be provided, such as the mini program ID, version number, description, etc. The additional information is dynamically transmitted through the parameter configuration of Jenkins.
[0037] After the upload is successful, the Mini Program platform will generate a preview code, which can be used to preview the effect of the Mini Program before the Mini Program is officially released. In Jenkins, the preview code is captured and displayed to the user in the build log or interface.
[0038] Step S4: When Jenkins compiles, it dynamically displays the Mini Program preview code so that developers can scan the preview code to experience and test the Mini Program.
[0039] The preview code is dynamically generated when Jenkins compilation ends. The preview code of the corresponding manufacturer's mini-program is automatically captured and displayed through Jenkins plug-ins or custom scripts. The preview code can improve testing efficiency.
[0040] For the custom script method, in the build script, based on the manufacturer name and the preview code information returned by the upload interface, dynamically generate an HTML page containing the preview code or directly output the preview code in the Jenkins console. In this way, testers only need to view the Jenkins console output or open the generated HTML page after the build is completed to scan the preview code for the mini program test.
[0041] Step S5: For different manufacturers, when Jenkins compilation is completed, the mini-program product is uploaded to the version control system of the corresponding mini-program platform for project review and release.
[0042] In the last step of the Jenkins build process, you need to upload the built mini-program product to the corresponding mini-program version control system. This step is crucial to ensure the consistency of mini-programs in different environments. When implementing this step, in the Jenkins build script, call the interface of the mini-program platform's version control system to upload the built mini-program product to the specified version branch, provide related information (such as version number, description, etc.) during the upload process, and the related information is also dynamically transmitted through Jenkins' parameter configuration. After the upload is successful, the operation and maintenance personnel operate the review process on each application platform.
[0043] In this step, for different vendor platforms, they are dynamically uploaded to the corresponding mini-program version control system when Jenkins compiles. The environment configuration of daily builds and production builds is consistent, which can avoid abnormalities in the construction of mini-program products due to differences in production configuration environments, and then cause some unknown abnormal failures, which is more conducive to the robustness of the entire R&D process. After the mini-program products are uploaded to each platform, the operation and maintenance personnel can directly go to each platform to operate the review process. Since Jenkins has completed most of the automation work, the operation and maintenance personnel only need to pay attention to some specific steps and precautions in the review process. This greatly improves the operation and maintenance efficiency, while also reducing the risk of human error.
[0044] Therefore, in summary, the present invention utilizes the Jenkins tool, dynamically configures parameters and aggregates multiple platform resources, and can build a preview version of the mini-program and the official version products required for operation and maintenance through one-click operation, which greatly improves the construction efficiency and the flexibility of version management.
[0045] 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 and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for dynamically configuring multi-terminal applets based on Jenkins, characterized in that: The method comprises the following steps: Step S1: Use Jenkins to perform parameterized configuration and specify the server and code branch that the mini-program build depends on; Step S2: Trigger the build task by clicking build manually or automatically; Step S3: Aggregate the mini program upload interfaces of various application-side manufacturers, call the CI build instructions of the corresponding manufacturer according to the parameterized configuration, generate the mini program product, and then call the corresponding manufacturer upload interface to upload the mini program product to the mini program platform, and the mini program platform generates a preview code; Step S4: When Jenkins compiles, it dynamically displays the Mini Program preview code, so that developers can scan the preview code to experience and test the Mini Program. Step S5: For different manufacturers, when Jenkins compilation is completed, the mini-program product is uploaded to the version control system of the corresponding mini-program platform for project review and release.
2. The method for dynamically configuring multi-terminal applets based on Jenkins as claimed in claim 1, characterized in that: The specific process of step S1 is as follows: Use the interface to create a new build task in Jenkins and dynamically configure parameterized builds, where the configured parameters include server address, server type, and code branch name.
3. The method for dynamically configuring multi-terminal applets based on Jenkins as claimed in claim 2, characterized in that: In step S2, the automatic triggering of the build task is implemented as follows: by configuring a Webhook receiver for the Git code repository, when the Git repository triggers the Webhook, Jenkins automatically receives the notification and starts the corresponding build task according to the configuration trigger.
4. The method for dynamically configuring multi-terminal applets based on Jenkins as claimed in claim 3, characterized in that: In step S3, the CI build instruction is a command line tool provided by the mini-program platform, or a custom script. By calling these CI build instructions, the mini-program product can be directly generated; in the process of uploading the mini-program product, additional information needs to be provided, and the additional information is dynamically transmitted through the parameter configuration of Jenkins; after uploading, the mini-program platform generates a preview code, Jenkins captures the preview code, and displays it to the user in the build log or interface.
5. The method for dynamically configuring multi-terminal applets based on Jenkins as claimed in claim 4, characterized in that: In step S4, the mini-program preview code is automatically captured and displayed through a Jenkins plug-in or a custom script. For the custom script method, an HTML page containing the preview code is dynamically generated according to the manufacturer name and the preview code information returned by the upload interface, or the preview code is directly output in the Jenkins console.
6. The method for dynamically configuring multi-terminal applets based on Jenkins as claimed in claim 5, characterized in that: The specific process of step S5 is as follows: build a script in Jenkins, call the interface of the version control system of the mini-program platform, upload the built mini-program product to the specified version branch, provide related information during the upload process, and dynamically transmit the related information through the parameter configuration of Jenkins. After the upload is successful, the operation and maintenance personnel operate the review process on each application platform.