Automatic compiling method and device for self-developed switch
Through the automated compilation method of self-developed switches, the problem of low manual compilation efficiency of self-developed switches is solved, efficient compilation process and rapid result feedback are achieved, and development efficiency and automated testing capabilities are improved.
Patent Information
- Application Number
- CN202510519338.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-19
AI Technical Summary
The manual compilation method of self-developed switches is inefficient, and it is inconvenient to troubleshoot compilation errors, which affects development efficiency.
It provides an automated compilation method for self-developed switches. By pulling the SONiC engineering code to be compiled from the code warehouse, determining the branch and switching chip types, establishing Shell automated compilation scripts, compiling the branches at the preset target time, and pushing the results when the compilation is successful, checking the reasons when the failure is made, uploading files to the remote product library for automated testing.
Improves compilation efficiency, reduces manual compilation time, ensures timely feedback and push of compilation results, saves developers' working time, and realizes automated testing and fast version verification.
Smart Images

Figure CN120508292A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of code compilation technology, and in particular to an automatic compilation method, device, computer equipment and storage medium for a self-developed switch. Background Art
[0002] Self-developed switches are switch devices independently developed, designed, and produced by enterprises. They are usually based on specific business needs and technical requirements to meet network communication needs in specific scenarios. The emergence of the SONiC open source switch system has played a key role in the development of self-developed switches. Enterprises can develop, compile, update, iterate, and release self-developed switch systems based on the SONiC system. In this process, compilation plays a vital role as an important part of the process. If developers use manual step-by-step compilation, it will inevitably affect development efficiency. Once a compilation error occurs, step-by-step troubleshooting will also cause great inconvenience to developers. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a method, apparatus, computer device, and storage medium for automatically compiling a self-developed switch to solve the technical problem of low efficiency of the existing manual compilation method for self-developed switches.
[0004] According to the first aspect, an embodiment of the present invention provides an automated compilation method for a self-developed switch, which pulls the SONiC engineering code to be compiled from the code repository, determines the branch to be compiled and updates the sub-repository; determines the switching chip type and version of the self-developed switch to be compiled; establishes a Shell automated compilation script and responds to the compilation operation of the branch at a preset target time based on the switching chip type and version of the self-developed switch to be compiled.
[0005] Optionally, the method further includes: when there are multiple versions to be compiled, starting the compilation operation of the next version according to the target interval time.
[0006] Optionally, the method further includes: when the compilation is successfully executed, pushing the compilation success result to the target terminal; when the compilation fails, responding to the troubleshooting work on the cause of the compilation failure and pushing relevant troubleshooting information to the target terminal.
[0007] Optionally, the method further includes: when the compilation is successfully executed, uploading the compiled version file and related deb packages to a remote product library; and sending the compiled version file and related deb packages to an automated testing system via an scp command.
[0008] Optionally, after sending the compiled version file and related deb packages to the automated testing system through the scp command, the method further includes: responding to a connection operation to the server where the automated tester is located and performing daily automated testing operations according to the compiled version file and related deb packages; when the daily automated testing operations are completed, starting the regression automated testing operations; when the time required for the regression automated testing is longer than a preset time, transferring the currently executed regression automated testing operation task to the background for execution.
[0009] Optionally, the method further includes: backing up the compiled SONiC compilation project file and saving all log files of the SONiC compilation service during the compilation process in a build log folder.
[0010] Optionally, when the compilation is successfully executed, the compiled version file and related deb package are uploaded to the remote product library, including: obtaining the URL to be uploaded to the remote product library and the corresponding account and password and selecting a file upload method, the file upload method including uploading all files or uploading specified files; if the file to be uploaded is a directory file and the selected file upload method is uploading all files, then a corresponding directory file is created in the remote product library and the original directory file name in the remote product library is updated to the newly uploaded directory file name; if the file to be uploaded is a directory file and the selected file upload method is uploading specified files, then the specified directory file is updated to the remote product library and the original directory file name in the remote product library remains unchanged; if the file to be uploaded is a component file and the selected file upload method is uploading all files, then all component files are directly uploaded to the remote product library; if the file to be uploaded is a component file and the selected file upload method is uploading specified files, then the specified component file to be uploaded is traversed in all component files and the traversed specified component file is uploaded to the remote product library.
[0011] According to the second aspect, an embodiment of the present invention provides an automatic compilation device for a self-developed switch, including: a pulling module, used to pull the SONiC engineering code to be compiled from the code repository, determine the branch to be compiled and update the sub-warehouse; a determination module, used to determine the switching chip type and version of the self-developed switch to be compiled; a first compilation module, used to establish a Shell automatic compilation script and respond to the compilation operation of the branch at a preset target time based on the switching chip type and version of the self-developed switch to be compiled.
[0012] According to a third aspect, an embodiment of the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to thereby execute the automated compilation method for the self-developed switch described in the first aspect or any optional embodiment of the first aspect.
[0013] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a computer to execute the automatic compilation method for the self-developed switch described in the first aspect or any optional implementation manner of the first aspect.
[0014] According to a fifth aspect, an embodiment of the present invention provides a computer program product, including computer instructions, which are used to cause a computer to execute the automatic compilation method for the self-developed switch described in the first aspect or any optional implementation manner of the first aspect.
[0015] The automated compilation method for the self-developed switch provided by the embodiment of the present invention pulls the SONiC engineering code to be compiled from the code warehouse, determines the branch to be compiled and updates the sub-warehouse, determines the switch chip type and version of the self-developed switch to be compiled, establishes a Shell automated compilation script, and responds to the compilation operation of the branch to be compiled at a preset target time based on the switch chip type and version of the self-developed switch to be compiled. By pulling the branch to be compiled and completing the compilation operation of the branch to be compiled based on the switch chip type and version to be compiled, combined with the established Shell automated compilation script, the compilation efficiency is improved compared to the manual compilation method. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 This is a flow chart of an automated compilation method for a self-developed switch according to an embodiment of the present invention;
[0018] Figure 2 This is another flow chart of the automated compilation method for a self-developed switch according to an embodiment of the present invention;
[0019] Figure 3 This is a structural block diagram of an automated compilation device for a self-developed switch according to an embodiment of the present invention;
[0020] Figure 4 It is a schematic diagram of the hardware structure of the computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0021] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0022] According to an embodiment of the present invention, an embodiment of an automated compilation method for a self-developed switch is provided. It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system, such as a set of computer-executable instructions. Moreover, although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be executed in a different order than shown.
[0023] Self-developed switches are switch devices independently developed, designed, and produced by enterprises. They are usually based on specific business needs and technical requirements to meet the network communication needs in specific scenarios. They break away from the limitations of closed traditional switch systems, long release cycles, and high operation and maintenance costs. They have the characteristics of open source code, independent and controllable development cycles, and unified management interfaces. Therefore, self-developed switches have gradually become the focus of attention. The emergence of the SONiC (Software for Open Networking in the Cloud) open source switch system has played a key role in the development of self-developed switches. Its system software architecture is simple and easy to customize and develop, which has been unanimously recognized by the industry. It has gradually become the mainstream operating system for self-developed switches, allowing enterprises to develop, compile, update, iterate, and release self-developed switch systems based on the SONiC system. In this process, compilation plays a vital role as an important part of the process. During the development process, if developers use manual step-by-step compilation, it will inevitably affect the development efficiency. Once a compilation error occurs, step-by-step troubleshooting will also bring great inconvenience to developers. Therefore, in the SONiC system development process, there is an urgent need for a simple and scalable automated compilation process to maintain daily code updates and iterations, ensure that the code engineering can successfully compile the SONiC system version and components, and provide timely feedback and push of the results.
[0024] In this embodiment, an automatic compilation method for a self-developed switch is provided, such as Figure 1 As shown, the process includes the following steps:
[0025] Step S101: Pull the SONiC project code to be compiled from the code repository, determine the branch to be compiled and update the sub-repository;
[0026] For example, SONiC code can be hosted on GitHub, and the SONiC project code to be compiled can be pulled from GitHub. The branch to be compiled can be determined based on the compiler's choice or by specifying the branch to be compiled, and the sub-warehouse where the branch code to be compiled is located can be updated to ensure code synchronization. A message to start compiling is pushed to the work group performing the compilation work, switching to the branch to be compiled, and updating the sub-warehouse.
[0027] Step S102 : Determine the switch chip type and version of the self-developed switch to be compiled. For example, the switch chip type and version of the self-developed switch to be compiled can be determined according to the actual manufacturer's compilation requirements, and perform configuration operations.
[0028] Step S103: Create a Shell automated compilation script and respond to the compilation operation of the branch at a preset target time based on the switch chip type and version of the self-developed switch to be compiled.
[0029] For example, a Shell automated compilation script is a collection of commands that run in a Unix / Linux system. A Shell interpreter (such as Bash) is used to execute the commands in the script line by line. Compilation-related commands are executed sequentially according to a predetermined logic, thereby completing the entire compilation process. In the embodiment of the present application, based on the manufacturer's version and the type of switch chip required for development, the Linux system service is enabled, and a Shell automated compilation script is established to start executing the compilation operation of the branch at a preset target time. In the embodiment of the present application, the preset target time can be to start compilation at midnight every day, so that compilation can be performed at a time when the server is less frequently used, reducing the impact on the normal operation of the system.
[0030] The automated compilation method for the self-developed switch provided by the embodiment of the present invention pulls the SONiC engineering code to be compiled from the code warehouse, determines the branch to be compiled and updates the sub-warehouse, determines the switch chip type and version of the self-developed switch to be compiled, establishes a Shell automated compilation script, and responds to the compilation operation of the branch to be compiled at a preset target time based on the switch chip type and version of the self-developed switch to be compiled. By pulling the branch to be compiled and completing the compilation operation of the branch to be compiled based on the switch chip type and version to be compiled, combined with the established Shell automated compilation script, the compilation efficiency is improved compared to the manual compilation method.
[0031] As an optional implementation of an embodiment of the present invention, the method further includes: when there are multiple versions to be compiled, starting the compilation operation of the next version according to the target interval duration. By starting the compilation operation of the next version according to the target interval duration, it is possible to avoid performing compilation operations on multiple versions at the same time, which may cause network transmission jitter due to a large amount of transmitted data, affecting the compilation process. The embodiment of the present application does not limit the target interval duration, and those skilled in the art can determine it according to actual needs. For example, the compilation operation of the next version can be started at an interval of 10 minutes without occupying the server working time.
[0032] As an optional implementation of an embodiment of the present invention, the method further includes: when the compilation is successfully executed, pushing the compilation success result to the target terminal; when the compilation fails, responding to the troubleshooting work of the cause of the compilation failure and pushing relevant troubleshooting information to the target terminal.
[0033] For example, the Shell automated compilation script determines whether the compilation is successful or not. If the compilation is successful, the result push is triggered and pushed to the work group so that other compilation development members can know the compilation result. If the compilation fails, the compilation verification is automatically performed to respond to the investigation of the cause of the compilation failure. Specifically, the compilation log is analyzed, the log of the component that failed to compile is automatically located, and the relevant error information is obtained and pushed to the work group. If the Shell automated compilation script has the authority of the code repository, it can filter out which merge caused the compilation failure based on the components that failed to compile and the error information in all the submission information compiled from the most recent successful compilation to this time. The relevant error information and location information and other related troubleshooting information are sent to the compilation developer terminal so that the developer can quickly locate the error location.
[0034] As an optional implementation of an embodiment of the present invention, the method further includes: when the compilation is successfully executed, uploading the compiled version file and related deb packages to the remote product library; sending the compiled version file and related deb packages to the automated testing system through the scp command. For example, based on the successful compilation, the compiled version file (bin package) and related deb packages are obtained and uploaded to the remote product library through the automatic upload process, and the latest compiled version is passed to the automated testing system through the scp command for automated testing. The upload function adopted in the embodiment of the present invention can directly upload components or versions by inputting command parameters. It only needs to specify the path to upload to the remote product library and the components to be uploaded, etc., and it can be uploaded with one click.
[0035] As an optional implementation manner of an embodiment of the present invention, after sending the compiled version file and related deb packages to the automated testing system through the scp command, the method also includes: responding to the connection operation of the server where the automated tester is located and performing daily automated testing operations according to the compiled version file and related deb packages; when the daily automated testing operations are completed, starting the regression automated testing operation; when the time required for the regression automated testing is greater than the preset time, transferring the currently executed regression automated testing operation task to the background for execution.
[0036] For example, upon successful compilation, the system automatically connects to the server hosting the automated tester, initiates daily automated verification, and executes daily automated tests based on the compiled version files and associated deb packages. The results are then pushed to the workgroup. After daily automation is complete, automated regression testing is initiated, automatically executing test cases. If the test case execution time exceeds a preset duration, the step can be postponed to the background while compiling other vendor versions.
[0037] The embodiment of the present application does not limit the preset time length, and those skilled in the art can determine it according to actual needs. After the compilation is completed, the version installation and verification can be automatically performed to save the time of the compiler developer to manually perform automated testing and avoid occupying the tester for too long. Through daily automated testing, the basic functions and key component modules of the software can be quickly verified to ensure that the code changes of the day do not introduce serious errors, ensure the basic availability of the software, and promptly discover problems in the new code so that developers can quickly fix them; through regression automated testing, it can be verified that after the software is modified or new functions are added, whether the original functions are still working normally, to ensure that the new code changes will not have a negative impact on the existing functions, and to prevent regression defects; at the same time, during the compilation process, version number information can be obtained from the configuration file, code comments or version control system and compared with the expected version number to realize version verification.
[0038] As an optional implementation of the embodiment of the present invention, the method further includes: backing up the compiled SONiC compilation project file and saving all log files of the SONiC compilation service during the compilation process in a build log folder so that developers can check the compilation process.
[0039] As an optional implementation of the embodiment of the present invention, when the compilation is successfully executed, uploading the compiled version file and related deb packages to the remote product library includes:
[0040] Obtain the URL that needs to be uploaded to the remote product library and the corresponding account and password and select the file upload method, which includes uploading all files or uploading specified files; for example, the URL of the remote product library can be customized by the user to upload the file path of the remote product library, and optional configuration parameters, namely the file upload method, can be provided. Through configuration, the current file upload method is selected to upload all files or upload specified files, or it can also be selected whether to upload according to version. Technical personnel in this field can configure the optional file upload method according to actual needs.
[0041] In software development, when using a build tool to build a project, the compiled results are typically placed in a target directory. This target directory contains various component files and directory files generated by the compilation, such as .class files, resource files, packaged JAR or WAR files, and possible intermediate directories. All files in the compiled target directory are traversed to determine whether they are directory files or component files.
[0042] If the file to be uploaded is a directory file and the selected file upload method is to upload all files, a corresponding directory file will be created in the remote product library and the original directory file name in the remote product library will be updated to the newly uploaded directory file name; if the file to be uploaded is a directory file and the selected file upload method is to upload a specified file, the specified directory file will be updated to the remote product library and the original directory file name in the remote product library will remain unchanged.
[0043] For example, if the file is a directory file, determine whether the configured upload method is to upload all files. If it is to upload all files, the component will create a remote directory file and update the original directory file name in the remote artifact library to the newly uploaded directory file name, and traverse the other remaining files under the compiled target directory; if the configured upload method is to upload specified files, then update the specified directory file to the remote artifact library and keep the original directory file name in the remote artifact library unchanged, and continue to traverse the other remaining files under the compiled target directory.
[0044] If the file to be uploaded is a component file and the selected file upload method is to upload all files, all component files will be uploaded directly to the remote artifact library; if the file to be uploaded is a component file and the selected file upload method is to upload specified files, the specified component file to be uploaded will be traversed among all component files and the traversed specified component file will be uploaded to the remote artifact library.
[0045] For example, if the file is a component file and the selected file upload method is "Upload all files," the component file is uploaded directly using the curl command, and the remaining files in the compiled target directory are traversed. If the file to be uploaded is a component file and the selected file upload method is "Specify file upload," the name of the specified uploaded file is extracted to determine whether the current component file is the specified component file. If so, the component file is uploaded to the specified remote artifact repository using the curl command. If not, the traversal continues until the specified component file is found. The target directory is then determined to be traversed. If so, the loop exits, ending the automatic upload process.
[0046] As a specific embodiment of this application, Figure 2 As shown, the implementation method of the automated process of compiling SONiC versions and components proposed in the embodiment of the present invention automatically compiles SONiC based on Shell scripts and Linux system services, and verifies, uploads, feedbacks, version checks and automatically regresses the compilation results, so that the SONiC project is automatically compiled the next day after the daily development is completed, which solves the problem of low efficiency caused by manual compilation by SONiC developers and the problem of overall compilation occupying a large amount of service resources during working hours; and the automated compilation process adopted can complete most of the content required for SONiC compilation, and the process can be expanded and modified as needed, such as compiling some components, automatically compiling and replacing docker, etc.
[0047] This embodiment also provides an automated compilation device for a self-developed switch. This device is used to implement the above-mentioned embodiments and preferred implementations. Details already described are omitted. The term "module" used below refers to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0048] This embodiment provides an automatic compilation device for a self-developed switch, such as Figure 3 Shown, including:
[0049] Pull module 401 is used to pull the SONiC project code to be compiled from the code repository, determine the branch to be compiled and update the sub-repository;
[0050] Determination module 402, used to determine the switch chip type and version of the self-developed switch to be compiled;
[0051] The first compilation module 403 is used to establish a Shell automated compilation script and respond to the compilation operation of the branch at a preset target time based on the switch chip type and version of the self-developed switch to be compiled. For detailed description, please refer to the corresponding description of the above method embodiment, which will not be repeated here.
[0052] The automatic compilation device of the self-developed switch in this embodiment is presented in the form of a functional unit. The unit here refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0053] The automated compilation device for the self-developed switch provided in this embodiment pulls the SONiC engineering code to be compiled from the code repository, determines the branch to be compiled and updates the sub-repository, determines the switch chip type and version of the self-developed switch to be compiled, establishes a Shell automated compilation script, and responds to the compilation operation of the branch to be compiled at a preset target time based on the switch chip type and version of the self-developed switch to be compiled. By pulling the branch to be compiled and completing the compilation operation of the branch to be compiled based on the switch chip type and version to be compiled, combined with the established Shell automated compilation script, the compilation efficiency is improved compared to the manual compilation method.
[0054] As an optional implementation of the embodiment of the present invention, the apparatus further includes: a second compiling module, configured to start the compilation operation of the next version according to the target interval duration when there are multiple versions to be compiled.
[0055] As an optional implementation of an embodiment of the present invention, the device also includes: a first push module, which is used to push the compilation execution success result to the target terminal when the compilation execution is successful; and a second push module, which is used to respond to the investigation of the cause of the compilation failure and push relevant investigation information to the target terminal when the compilation execution fails.
[0056] As an optional implementation of an embodiment of the present invention, the device also includes: an upload module, which is used to upload the compiled version file and related deb packages to a remote product library when the compilation is successfully executed; and a sending module, which is used to send the compiled version file and related deb packages to the automated testing system through the scp command.
[0057] As an optional implementation scheme of the embodiment of the present invention, the device also includes: a first verification module, which is used to respond to the connection operation of the server where the automated tester is located and perform daily automated testing operations according to the compiled version file and related deb packages; a second verification module, which is used to start the regression automated testing operation after the daily automated testing operation is completed; and a handover module, which is used to hand over the currently executed regression automated testing operation task to the background for execution when the time required for the regression automated testing is greater than the preset time.
[0058] As an optional implementation of the embodiment of the present invention, the device further includes: a backup module, which is used to back up the compiled SONiC compilation project files and save all log files of the SONiC compilation service during the compilation process in a build log folder.
[0059] As an optional implementation manner of an embodiment of the present invention, the upload module includes: an acquisition unit, which is used to obtain the URL and corresponding account and password to be uploaded to the remote product library and select a file upload method, and the file upload method includes uploading all files or uploading specified files; a first upload unit, which is used to create a corresponding directory file in the remote product library and update the original directory file name in the remote product library to the newly uploaded directory file name if the file to be uploaded is a directory file and the selected file upload method is uploading all files; a second upload unit, which is used to update the specified directory file to the remote product library and keep the original directory file name in the remote product library unchanged if the file to be uploaded is a directory file and the selected file upload method is uploading specified files; a third upload unit, which is used to directly upload all component files to the remote product library if the file to be uploaded is a component file and the selected file upload method is uploading all files; a fourth upload unit, which is used to traverse the specified component file to be uploaded in all component files and upload the traversed specified component file to the remote product library if the file to be uploaded is a component file and the selected file upload method is uploading specified files.
[0060] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0061] The automatic compilation device of the self-developed switch in this embodiment is presented in the form of a functional unit. The unit here refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0062] The embodiment of the present invention also provides a computer device having the above Figure 3The automatic compilation device of the self-developed switch is shown.
[0063] See also Figure 4 , Figure 4 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 4 As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.
[0064] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.
[0065] The memory 20 stores instructions that can be executed by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0066] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0067] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0068] The computer device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 4 The bus connection is taken as an example.
[0069] The input device 30 can receive input digital or character information and generate key signal input related to user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touch pad, an indicator stick, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 can include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display, and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0070] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.
[0071] A portion of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by the computer.
[0072] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. An automated compilation method for a self-developed switch, characterized in that: include: Pull the SONiC project code to be compiled from the code repository, determine the branch to be compiled and update the sub-repository; Determine the switch chip type and version of the self-developed switch to be compiled; A Shell automated compilation script is established and based on the switch chip type and version of the self-developed switch to be compiled, the compilation operation of the branch is responded to at a preset target time.
2. The method according to claim 1, characterized in that The method further comprises: When there are multiple versions to be compiled, start compiling the next version according to the target interval.
3. The method according to claim 1, characterized in that The method further comprises: When the compilation is successful, the compilation result is pushed to the target terminal; When the compilation fails, the cause of the compilation failure is investigated and relevant investigation information is pushed to the target terminal.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: When the compilation is successful, the compiled version file and related deb packages are uploaded to the remote artifact library; The compiled version file and related deb packages are sent to the automated testing system through the scp command.
5. The method according to claim 4, characterized in that After sending the compiled version file and related deb packages to the automated testing system through the scp command, the method further includes: Responding to the connection operation to the server where the automated tester is located and performing daily automated testing operations according to the compiled version file and related deb packages; After the daily automated testing operation is completed, the regression automated testing operation is started; When the time required for regression automation testing exceeds the preset time, the currently executing regression automation testing operation task will be transferred to the background for execution.
6. The method according to claim 4, characterized in that The method further comprises: Back up the compiled SONiC compilation project files and save all log files of the SONiC compilation service during the compilation process in the build log folder.
7. The method according to claim 4, characterized in that When the compilation is successful, the compiled version file and related deb packages are uploaded to the remote artifact library, including: Obtain the URL, account number, and password required to upload to the remote repository and select a file upload method, which includes uploading all files or uploading specific files. If the file to be uploaded is a directory file and the selected file upload method is to upload all files, a corresponding directory file is created in the remote artifact library and the original directory file name in the remote artifact library is updated to the newly uploaded directory file name; If the file to be uploaded is a directory file and the selected file upload method is specified file upload, the specified directory file is updated to the remote artifact library and the original directory file name in the remote artifact library is kept unchanged; If the file to be uploaded is a component file and the selected file upload method is to upload all files, all component files will be directly uploaded to the remote artifact library; If the file to be uploaded is a component file and the selected file upload method is specified file upload, the specified component file to be uploaded is traversed in all component files and the traversed specified component file is uploaded to the remote artifact library.
8. An automated compilation device for a self-developed switch, characterized in that: include: The pull module is used to pull the SONiC project code to be compiled from the code repository, determine the branch to be compiled and update the sub-repository; The determination module is used to determine the switch chip type and version of the self-developed switch to be compiled; The first compilation module is used to establish a Shell automatic compilation script and respond to the compilation operation of the branch at a preset target time based on the switching chip type and version of the self-developed switch to be compiled.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the automatic compilation method for the self-developed switch according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the automatic compilation method for the self-developed switch according to any one of claims 1 to 7.