Compilation construction method and device
By assigning projects with different compilation and build security levels to different compilation builders, and configuring corresponding security settings according to the security levels, the problem of difficulty in balancing security and efficiency in the existing technology is solved, and higher compilation and build security is achieved. sex and efficiency.
Patent Information
- Application Number
- CN202310165117.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2024-09-03
AI Technical Summary
Existing compilation and build technology is difficult to achieve a balance between security and efficiency when processing high-risk script commands. Especially when different projects have different security requirements, security issues or low efficiency are prone to occur.
By assigning projects with different compilation and build security levels to different compilation builders, and configuring corresponding security settings according to the project's security level, including isolating different compilation builders to prohibit or allow parallel compilation and build, and limiting the reference scope of the code warehouse , to achieve a balance between security and efficiency.
It improves the overall security of compilation and construction, avoids injection vulnerabilities, improves the efficiency of compilation and construction, and meets the security and efficiency requirements of different projects.
Smart Images

Figure CN118585997A
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud technology, and more specifically, to a compilation and construction method and apparatus, a computing device, a computing device cluster, a computer program product, and a computer-readable storage medium. Background Art
[0002] Compilation and construction are important links in software production and also important links in software supply chain security. During the compilation and construction process, various commands will be triggered to execute, especially high-risk script commands. The relevant technical solutions are aimed at commands, and a command blacklist or command whitelist is established. However, if a command blacklist is used, it is impossible to exhaustively clean the operations of high-risk commands, and if a command whitelist is used, it is difficult to meet the dependency requirements of special projects on certain commands.
[0003] Therefore, how to improve the security of compilation and construction is an urgent problem to be solved. Summary of the invention
[0004] The present application provides a compilation and construction method, which improves the security of the compilation and construction by allocating projects with different compilation and construction security levels to different compilation builders, and helps to achieve a balance between security and efficiency.
[0005] In a first aspect, a compilation and construction method is provided, comprising: a compilation and construction device determines a compilation and construction security level of each project in N projects, wherein N is a positive integer greater than or equal to 2; the compilation and construction device determines at least two compilation builders according to the compilation and construction security levels of the N projects, wherein each compilation builder in the at least two compilation builders corresponds to at least one project in the N projects, and the compilation and construction security levels of the projects corresponding to any two compilation builders in the at least two compilation builders are different, and the at least two compilation builders are isolated from each other; the compilation and construction device compiles and builds the N projects in the at least two compilation builders, wherein each project in the N projects is compiled and constructed in the corresponding compilation builder.
[0006] The at least two compilation builders are isolated from each other, which may mean that there is no communication interface between the at least two compilation builders.
[0007] In practice, different projects have different security requirements. The relevant technical solution assigns multiple projects to a compilation builder for compilation and construction, and for the efficiency of the compilation and construction, too many restrictions are not set for the compilation builder. However, if the security requirements of these projects are different, the projects with higher security requirements are prone to security problems during compilation and construction. The compilation and construction method provided in the embodiment of the present application assigns projects with different compilation and construction security levels to different compilation and construction builders. For example, on the one hand, the restrictions of the compilation and construction builders corresponding to the projects with higher security requirements can be increased as needed, thereby improving the security of the compilation and construction as a whole. On the other hand, for projects with lower security requirements, a compilation and construction builder with a looser security configuration can be used, which helps to achieve a balance between security and efficiency.
[0008] In combination with the first aspect, in certain implementations of the first aspect, the compilation and construction device determines the compilation and construction security level of each project among N projects, including: the compilation and construction device determines the security level of the associated code repository of the nth project among the N projects, wherein part or all of the code of the nth project comes from the associated code repository of the nth project, n=1,...,N; the compilation and construction device determines the compilation and construction security level of the nth project based on the security level of the associated code repository of the nth project.
[0009] Projects associated with different code repositories often have different security requirements. For example, projects associated with code repositories with high security requirements require the compilation builder to have higher security, while projects associated with code repositories with low security requirements require a more efficient compilation builder with lower security requirements. In the embodiment of the present application, the compilation and construction security level of each project is determined by associating the security level of the code repositories, thereby achieving a balance between the security and efficiency of the compilation and construction.
[0010] In combination with the first aspect, in certain implementations of the first aspect, when the compilation and build security level of a first project meets preset conditions, the compilation builder corresponding to the first project is a compilation builder configured to prohibit parallel compilation and build, and the first project is any one of the N projects; when the compilation and build security level of the first project does not meet the preset conditions, the compilation builder corresponding to the first project is a compilation builder configured to allow parallel compilation and build.
[0011] In the embodiment of the present application, when the project's compilation and construction security level meets the preset conditions, the determined compilation builder prohibits parallel compilation and construction, realizes "single project execution", avoids injection-type vulnerabilities, and further improves the security of the compilation and construction. In the case of not meeting the preset conditions, the determined compilation builder allows parallel compilation and construction, which improves the efficiency of the compilation and construction. Combining the above two situations, the embodiment of the present application can achieve a balance between the security and efficiency of the compilation and construction.
[0012] In combination with the first aspect, in certain implementations of the first aspect, the reference scope of the dependent code repository of the compilation builder corresponding to the second project corresponds to the compilation and construction security level of the second project, and the second project is any one of the N projects.
[0013] The reference scope of dependent code repositories includes: not referencing any dependent code repositories, only referencing local dependent code repositories, and referencing local code repositories and external code repositories.
[0014] In the embodiment of the present application, different ranges of dependent code repositories are determined for different compilation and construction security levels, so as to meet the security requirements and efficiency requirements of different projects and achieve a balance between the security and efficiency of the compilation and construction.
[0015] In combination with the first aspect, in certain implementations of the first aspect, the compilation and construction device determines the compilation and construction security level of each project in N projects, including: the compilation and construction device determines the security level of the nth project in the N projects, where n=1,...,N; the compilation and construction device determines that the compilation and construction security level of the nth project is the security level of the nth project.
[0016] Different projects often have different security requirements. For example, for projects with high security requirements, the compilation builder needs to have higher security, and for projects with low security requirements, a more efficient compilation builder needs to be used, and the security requirements are lower. In the embodiment of the present application, the compilation and construction security level of the project is determined to be the security level of the project, achieving a balance between the security and efficiency of the compilation and construction.
[0017] In combination with the first aspect, in certain implementations of the first aspect, the compilation and construction device determines the compilation and construction security level of each project in N projects, including: the compilation and construction device determines the security level of the associated code repository of the nth project in the N projects and the security level of the nth project, wherein part or all of the code of the nth project comes from the associated code repository of the nth project, n=1,...,N; the compilation and construction device determines the compilation and construction security level of the nth project based on the security level of the associated code repository of the nth project and the security level of the nth project.
[0018] In an embodiment of the present application, the compilation and construction security level of the project can be determined based on the security level of the associated code repository and the security level of the project, so as to better adapt to the security requirements and efficiency requirements of different projects and achieve a balance between the security and efficiency of the compilation and construction.
[0019] In combination with the first aspect, in some implementations of the first aspect, the method is applied to a cloud management platform or a cloud data center.
[0020] In a second aspect, an embodiment of the present application provides a compilation and construction device, the computer device including a module for implementing the first aspect or any possible implementation method of the first aspect.
[0021] In a third aspect, a computing device is provided, including a processor and a memory, wherein the processor is used to execute instructions stored in the memory so that the computing device executes the compilation and construction method of the first aspect or any possible implementation of the first aspect.
[0022] In a fourth aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the compilation and construction method of the first aspect or any possible implementation of the first aspect.
[0023] In a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device, the computing device executes the compilation and construction method of the first aspect or any possible implementation of the first aspect.
[0024] In a sixth aspect, a computer program product including instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the compilation and construction method of the first aspect or any possible implementation manner of the first aspect.
[0025] In a seventh aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the compilation and construction method of the first aspect or any possible implementation of the first aspect.
[0026] In an eighth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the compilation and construction method of the first aspect or any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1It is a schematic flowchart of a compilation and construction method.
[0028] Figure 2 It is a schematic diagram of a compilation and construction method.
[0029] Figure 3 It is a schematic flow chart of a compilation and construction method provided by this application.
[0030] Figure 4 It is a schematic flow chart of another compilation and construction method provided in an embodiment of the present application.
[0031] Figure 5 It is a schematic diagram of another compilation and construction method provided in an embodiment of the present application.
[0032] Figure 6 It is a schematic flow chart of another compilation and construction method provided in an embodiment of the present application.
[0033] Figure 7 It is a schematic block diagram of a compilation and construction device 700 provided in an embodiment of the present application.
[0034] Figure 8 An embodiment of the present application provides a schematic diagram of the architecture of a computing device 800.
[0035] Fig. 9 It is a schematic diagram of the architecture of a computing device cluster provided in an embodiment of the present application.
[0036] Fig.10 It is a schematic diagram of a connection between computing devices 800A and 800B via a network provided in an embodiment of the present application.
[0037] Fig.11 It is a schematic diagram of a cloud server-based system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0039] The present application will present various aspects, embodiments or features around a system that may include multiple devices, components, modules, etc. It should be understood and appreciated that each system may include additional devices, components, modules, etc., and / or may not include all of the devices, components, modules, etc. discussed in conjunction with the figures. In addition, combinations of these schemes may also be used.
[0040] In addition, in the embodiments of the present application, words such as "exemplary" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present concepts in a concrete way.
[0041] The network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person of ordinary skill in the art can appreciate that with the evolution of the network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0042] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0043] To facilitate understanding, relevant terms and concepts that may be involved in the embodiments of the present application are first introduced below.
[0044] Compile: Compilation is the process of converting source code into target code, that is, compilation can convert the language of the source code into another computer language.
[0045] Build: A build can be a series of processes, which may include compilation, and ultimately generate software products that run in a specific feature environment.
[0046] It should be noted that, in this application, compilation and construction can summarize the process of compilation and / or construction, and compilation and construction can transform source code to generate software products.
[0047] Figure 1 A schematic flow chart of a compiling and building method is shown. It should be noted that: Figure 1 The solutions shown do not constitute limitations to the present application.
[0048] S110, creating project 1, project 2, and project 3.
[0049] S120: Create a code repository and upload the code.
[0050] S130, allocating Project 1, Project 2, and Project 3 to a compilation and construction cluster for compilation and construction.
[0051] Figure 2 A schematic diagram of a compilation and construction method is shown. Figure 2 is in accordance with Figure 1 The result of executing the compilation and construction method. Figure 2 In a compilation and build cluster, Project 1, Project 2, and Project 3 are compiled and built, thereby generating codes for Project 1, Project 2, and Project 3 respectively. Generally speaking, in order to rationally utilize resources and improve compilation and build efficiency, in addition to relying on local code repositories, compilation and build clusters also rely on external code repositories.
[0052] However, if according to Figure 1 In the compilation and construction method shown, each project is in the same compilation and construction cluster, and there is no isolation between the projects. In the field of cloud technology, different tenants have different requirements. If the projects of different tenants are not isolated, it will bring security risks. Even for the same tenant or user, different projects have different requirements for security. If projects with different security requirements are assigned to a compilation and construction cluster, security problems may occur for projects with high security requirements. If the security configuration of the compilation and construction cluster is improved, the efficiency of compilation and construction will be affected for projects with low security requirements.
[0053] in addition, Figure 1 The compilation and construction method shown may also have injection vulnerabilities. Figure 2 , Project 1, Project 2, and Project 3 all reference local code repositories and external code repositories. Assume that Project 1 pulls the code from the external code repository during the compilation and build process, while Project 2 and Project 3 only pull the code from the local code repository. When the external code repository contains malicious code, although Project 2 and Project 3 do not pull the code from the external code repository for security reasons. However, since the projects are not isolated, or because the projects are compiled and built in parallel, these malicious codes can penetrate into Project 2 and Project 3, causing Project 2 and Project 3 to be successfully poisoned. Figure 2 The dotted line in the figure represents the path of the malicious code. In this way, the mutual penetration between different projects may lead to the theft of code or damage the integrity of the software product. In other words, Figure 1 The compilation and construction method shown has the risk of asset leakage and poisoning.
[0054] Figure 3A schematic flow chart of a compilation and construction method provided by the present application is shown. The compilation and construction method allocates projects of different compilation and construction security levels to different compilation builders for compilation and construction, which can improve the security of compilation and construction and help achieve a balance between security and efficiency.
[0055] S310 , the compiling and building apparatus determines a compiling and building security level of each of N projects, where N is a positive integer greater than or equal to 2.
[0056] Exemplarily, the compilation and construction security level can be a discrete value (e.g., 1, 2, 3), and the larger the value, the higher the compilation and construction security level. The compilation and construction security level can also be a continuous value, and can also be expressed in other forms, such as high, medium, low, A, B, C, etc. It can be understood that the specific form of the compilation and construction security level is not limited in this application.
[0057] Optionally, the compilation and construction device determines the compilation and construction security level of each project among N projects, including: the compilation and construction device determines the security level of the associated code repository of the nth project among the N projects, wherein part or all of the code of the nth project comes from the associated code repository of the nth project, n=1,...,N; the compilation and construction device determines the compilation and construction security level of the nth project based on the security level of the associated code repository of the nth project.
[0058] For example, after creating a new compile and build project, a new code repository can be created by integrating code repositories. These integrated code repositories can be called associated code repositories. If the integrated code repository has a security level, then the security level of the integrated code repository can be determined to be the compile and build security level of the project.
[0059] In some embodiments, if a project has multiple associated code repositories, and these associated code repositories have different security levels, the highest security level can be determined as the compilation and build security level of the project.
[0060] In other embodiments, if a project has multiple associated code repositories, and these associated code repositories have different security levels, the lowest security level can be determined as the compilation and build security level of the project.
[0061] In some other embodiments, if a project has multiple associated code repositories, and these associated code repositories have different security levels, one of the security levels can be determined as the compilation and build security level of the project.
[0062] For example, if a project has multiple associated code repositories, and these associated code repositories have different security levels, the average security level of these associated code repositories can be determined as the compilation and build security level of the project.
[0063] It can be understood that if a project has only one associated code repository, the security level of the associated code repository is determined as the compilation and build security level of the project.
[0064] Projects associated with different code repositories often have different security requirements. For example, projects associated with code repositories with high security requirements require the compilation builder to have higher security, while projects associated with code repositories with low security requirements require a more efficient compilation builder with lower security requirements. In the embodiment of the present application, the compilation and construction security level of each project is determined by associating the security level of the code repositories, thereby achieving a balance between the security and efficiency of the compilation and construction.
[0065] Optionally, the compilation and construction device determines the compilation and construction security level of each project among N projects, including: the compilation and construction device determines the security level of the nth project among the N projects, where n=1,...,N; the compilation and construction device determines that the compilation and construction security level of the nth project is the security level of the nth project.
[0066] Exemplarily, the security level of a project may be preset, thereby determining that the compile and build security level of the project is the security level of the project.
[0067] In some embodiments, after setting up a project, the compiling and building security level of the project can be manually set. In this case, the security level manually input can be regarded as the security level of the project, and then the compiling and building device can determine the security level of the project as the compiling and building security level of the project.
[0068] Different projects often have different security requirements. For example, for projects with high security requirements, the compilation builder needs to have higher security, and for projects with low security requirements, a more efficient compilation builder needs to be used, and the security requirements are lower. In the embodiment of the present application, the compilation and construction security level of the project is determined to be the security level of the project, achieving a balance between the security and efficiency of the compilation and construction.
[0069] Optionally, the compilation and construction device determines the compilation and construction security level of each project among N projects, including: the compilation and construction device determines the security level of the associated code repository of the nth project among the N projects and the security level of the nth project, wherein part or all of the code of the nth project comes from the associated code repository of the nth project, n=1,...,N; the compilation and construction device determines the compilation and construction security level of the nth project based on the security level of the associated code repository of the nth project and the security level of the nth project.
[0070] For example, the security level of the associated code warehouse may be core, general, open, etc. The security level of the associated code warehouse may also be a discrete value (eg, level 1, level 2, level 3, etc.) or a continuous value.
[0071] In some embodiments, the lower security level of the security level of the associated code repository and the security level of the project can be determined as the compilation and build security level of the project.
[0072] In other embodiments, a higher security level between the security level of the associated code repository and the security level of the project may be determined as the compilation and build security level of the project.
[0073] In an embodiment of the present application, the compilation and construction security level of the project can be determined based on the security level of the associated code repository and the security level of the project, so as to better adapt to the security requirements and efficiency requirements of different projects and achieve a balance between the security and efficiency of the compilation and construction.
[0074] S330, the compilation and construction device determines at least two compilation builders according to the compilation and construction security levels of the N projects, wherein each of the at least two compilation builders corresponds to at least one project of the N projects, the compilation and construction security levels of the projects corresponding to any two compilation builders of the at least two compilation builders are different, and the at least two compilation builders are isolated from each other.
[0075] For example, for projects with a higher compile and build security level, the security configuration of the determined compile builder is more stringent to improve security. For projects with a lower compile and build security level, the security configuration of the determined compile builder is more relaxed to reduce costs and improve resource utilization.
[0076] It should be noted that the compilation builder may be pre-configured, and determining the compilation builder in S330 may refer to selecting a configured compilation builder. The compilation builder may also be ready to be configured, that is, determining the compilation builder may refer to configuring the compilation builder.
[0077] It can be understood that different compilation builders may have different compilation and construction execution standards between different compilation builders. For example, some compilation builders may allow dependence on external code repositories, while some compilation builders prohibit dependence on external code repositories. For another example, some compilation builders may allow multiple projects to be executed in parallel, that is, multiple projects are compiled and built at the same time, while some compilation builders prohibit multiple projects from being executed in parallel, that is, when one project is compiled and built, other projects cannot be compiled and built.
[0078] The at least two compilation builders are isolated from each other, and there may be no communication interface between the at least two compilation builders.
[0079] In some embodiments, each compilation builder is isolated from each other. That is, different compilation builders are isolated from each other, and the code in one compilation builder will not penetrate into another compilation builder. For example, the isolation of each compilation builder can be achieved through a virtual private cloud (VPC). VPC is a dynamically configured pool of public cloud computing resources, which requires the use of encryption protocols, tunneling protocols and other security procedures to transmit data between tenants and cloud service providers. For example, compilation builders can be built separately in multiple VPCs to achieve isolation of each compilation builder.
[0080] Optionally, when the compilation and build safety level of the first project meets preset conditions, the compilation builder corresponding to the first project is a compilation builder configured to prohibit parallel compilation and build, and the first project is any one of the N projects; when the compilation and build safety level of the first project does not meet the preset conditions, the compilation builder corresponding to the first project is a compilation builder configured to allow parallel compilation and build.
[0081] The project's build security level meets the preset conditions, which can be that the build security level is higher than a certain threshold, for example, the build security level is higher than 2, or that the build security level meets a specific value, for example, the build security level is advanced or A.
[0082] If parallel compilation is allowed, Figure 2 Injection vulnerability shown. That is to say, even if this project does not pull code from a certain code repository, it may be poisoned because other projects have pulled malicious code. Therefore, prohibiting the project from compiling and building in parallel with other projects often corresponds to a higher level of compilation and build security. It should be noted that the "higher level" of compilation and build security level mentioned here does not mean the highest level of compilation and build security level. Those skilled in the art can set an appropriate level as a preset condition according to their own needs.
[0083] It can be understood that allowing or prohibiting the project from being compiled and built in parallel with other projects is one aspect of the security configuration of the compilation builder, but it is not the only aspect. For example, the compilation builder can also limit the scope of the code repository that the project depends on during configuration.
[0084] In the embodiment of the present application, when the project's compilation and construction security level meets the preset conditions, it is determined that parallel compilation and construction are prohibited, so as to realize "single project execution", avoid injection-type vulnerabilities, and further improve the security of compilation and construction. In the case of not meeting the preset conditions, the determined compilation builder allows parallel compilation and construction, which improves the efficiency of compilation and construction. Combining the above two situations, the embodiment of the present application can achieve a balance between the security and efficiency of compilation and construction.
[0085] Optionally, the reference scope of the dependent code repository of the compilation builder corresponding to the second project corresponds to the compilation and construction security level of the second project, and the second project is any one of the N projects.
[0086] Dependent code repositories can refer to code repositories that are referenced by a project during compilation and building. For example, the code in a project can call the code in a dependent code repositories without writing the code in the dependent code repositories into the project. This can reduce the workload of writing code and improve the efficiency of compilation and building.
[0087] The reference scope of the dependent code repository can include: not referencing any dependent code repository, only referencing the local dependent code repository, and referencing the local code repository and the external code repository.
[0088] For example, a higher compile and build security level may correspond to a stricter code repository dependency, such as prohibiting dependency on any code repository, or only allowing dependency on local private code repositories. A lower compile and build security level may correspond to a looser code repository dependency, such as allowing dependency on external third-party code repositories.
[0089] For example, when the compilation and build security level is high, the dependent code repository referenced by the compilation builder is empty; when the compilation and build security level is medium, the dependent code repository referenced by the compilation builder is a local private code repository; when the compilation and build security level is low, the dependent code repository referenced by the compilation builder is a third-party code repository and a local private code repository.
[0090] It can be understood that when it is forbidden to depend on any code warehouse, the dependent code warehouse is empty. In other words, prohibiting the dependence on any code warehouse is also a situation where the compilation builder references the dependent code warehouse.
[0091] In the embodiment of the present application, different ranges of dependent code repositories are determined for different compilation and construction security levels, so as to meet the security requirements and efficiency requirements of different projects and achieve a balance between the security and efficiency of the compilation and construction.
[0092] S350: The compiling and constructing device compiles and constructs the N projects in the at least two compiling and constructing tools, wherein each of the N projects is compiled and constructed in a corresponding compiling and constructing tool.
[0093] In some embodiments, after the project is compiled and constructed, a software product is generated; the software product is transmitted according to the compilation and construction security level. For example, the software product is transmitted to a software product warehouse corresponding to the compilation and construction security level. For example, the software product may include a software package, a compressed package, etc., which is not limited in this application.
[0094] In practice, different projects have different security requirements. The relevant technical solution assigns multiple projects to a compilation builder for compilation and construction, and for the efficiency of the compilation and construction, too many restrictions are not set for the compilation builder. However, if the security requirements of these projects are different, the projects with higher security requirements are prone to security problems during compilation and construction. The compilation and construction method provided in the embodiment of the present application assigns projects with different compilation and construction security levels to different compilation and construction builders. For example, on the one hand, the restrictions of the compilation and construction builders corresponding to the projects with higher security requirements can be increased as needed, thereby improving the security of the compilation and construction as a whole. On the other hand, for projects with lower security requirements, a compilation and construction builder with a looser security configuration can be used, which helps to achieve a balance between security and efficiency.
[0095] Optionally, the method is applied to a cloud management platform or a cloud data center.
[0096] For example, the method provided in the embodiment of the present application can be applied in public clouds, hybrid clouds, and private clouds without the need for adaptive adjustments, which can reduce the workload of compilation and construction and improve the efficiency of compilation and construction.
[0097] Figure 4 A schematic flowchart of another compilation and construction method provided in an embodiment of the present application is shown.
[0098] S410, creating a project.
[0099] In some embodiments, the security level of the project may be set after the project is created, and the security level of the project may be used to determine the compilation and construction security level of the project.
[0100] S430: Create a code repository and upload the code.
[0101] In some embodiments, at least one code repository may be integrated to establish a new code repository. The security level of the at least one integrated code repository, that is, the security level of the associated code repository, may be used to determine the compilation and construction security level of the project.
[0102] In other embodiments, the security level of the project and the security level of the associated code repository are comprehensively judged to determine the compilation and construction security level of the project. For example, the security level of the project may be preferentially determined as the compilation and construction security level of the project, or the higher security level of the security level of the project and the security level of the associated code repository may be determined as the compilation and construction security level of the project.
[0103] S450: Allocate the project to a corresponding compilation builder according to the compilation and construction security level of the project.
[0104] For example, if the compilation and build security level of the project is level 1, the project will be assigned to the level 1 compilation builder.
[0105] S470, compile and build the project.
[0106] Figure 5 A schematic diagram of another compilation and construction method provided in an embodiment of the present application is shown. It can be understood that Figure 5 It can also be expressed Figure 4 An embodiment of a compilation and construction method.
[0107] See also Figure 5 , you can set up level 1, level 2, and level 3 builders. Among them, the security configuration of the level 1 builder is relatively loose, allowing multiple projects to be executed at the same time and relying on external code repositories; the security configuration of the level 2 builder is relatively strict, prohibiting the execution of multiple projects at the same time and only allowing reliance on local trusted code repositories; the level 3 build executor is more strict, prohibiting the execution of multiple projects at the same time and prohibiting reliance on code repositories. It is understandable that Figure 5 This is only an example and does not constitute a limitation of the present application. A person skilled in the art may set more levels, or may set more levels (for example, more than 4 levels), or may configure a compilation builder with different security configurations. For example, a command whitelist, a command blacklist, etc. may be set.
[0108] In some embodiments, for projects with high security requirements, a compilation builder with strict security configuration can be constructed to prohibit the parallel execution of multiple projects and prohibit dependence on code repositories, so as to ensure the security of the project during the compilation and construction process as much as possible; for compilation and construction tasks with low security requirements or low cost requirements, one compilation builder is allowed to execute multiple projects in parallel, and flexible dependence on external code repositories is allowed to meet the balance and choice between security and cost for businesses with different security requirements.
[0109] Figure 6 A schematic flow chart of another compilation and construction method provided by an embodiment of the present application is shown. Some embodiments of each stage are described below.
[0110] Project preparation stage:
[0111] Create a project. For example, you can also provide an interface or configuration file.
[0112] In some embodiments, the security level of the project can be configured. Further, in some embodiments, the security level of the project can be determined as the compilation and construction security level of the project.
[0113] Code preparation stage:
[0114] Create a code repository to download and prepare code for compilation and building according to the configured code repository path.
[0115] In some embodiments, at least one code warehouse is integrated to create a new code warehouse, and the integrated at least one code warehouse has a security level. In other words, the associated code warehouse can have a security level.
[0116] Task scheduling phase:
[0117] During the task scheduling phase, the compilation and construction device can determine the compilation and construction security level of the project.
[0118] In some embodiments, the security level of the associated code repository can be determined as the compilation build security level of the project.
[0119] In other embodiments, one of the security level of the associated code repository and the security level of the project is determined as the compilation build security level of the project.
[0120] In still other embodiments, the security level of a project may be determined as a compilation build security level of the project.
[0121] The compile and build device can also prepare a corresponding compile builder. For example, according to the requirements of the compile and build security level, set the security compile options and the dependency path of the external code warehouse. That is to say, before the compile and build is executed, you can customize the security compile options of different languages, configure the isolation between the compile builder and the outside, and configure the dependency relationship between the local code warehouse or the external code warehouse.
[0122] The compiling and building device can also distribute the project to a corresponding compiling and building device (or compiling and building machine) to execute tasks, that is, to perform compiling and building, according to the compiling and building security level.
[0123] Task execution phase:
[0124] The compiling and constructing device may execute the project in a corresponding compiling and constructing device. In some embodiments, during the execution process, the compiling and constructing device may determine whether to rely on the code warehouse according to the compiling and constructing security level of the project.
[0125] In some embodiments, after the compilation and construction of the project is completed, the software product generated by the project is transmitted according to the compilation and construction security level. For example, the software product is transmitted to a software product warehouse corresponding to the compilation and construction security level.
[0126] Combined with the above Figures 3 to 6 The method embodiments of the present application are described in detail. The device embodiments of the present application are described below. The device embodiments correspond to the method embodiments, so the parts not described in detail can refer to the previous method embodiments. The device can implement any possible implementation of the above method.
[0127] The present application also provides a compiling and constructing device 700, such as Figure 7 As shown, the device 700 includes:
[0128] The grading module 710 is used to determine the compilation and construction safety level of each project in N projects, where N is a positive integer greater than or equal to 2.
[0129] The processing module 720 is used to determine at least two compilation builders according to the compilation and build security levels of the N projects, wherein each of the at least two compilation builders corresponds to at least one project of the N projects, the compilation and build security levels of the projects corresponding to any two compilation builders of the at least two compilation builders are different, and the at least two compilation builders are isolated from each other.
[0130] The compiling and building module 730 is used to compile and build the N projects in the at least two compiling and building tools, wherein each of the N projects is compiled and built in a corresponding compiling and building tool.
[0131] Among them, the classification module 710, the processing module 720 and the compilation construction module 730 can all be implemented by software, or can be implemented by hardware. Exemplarily, the classification module 710 is taken as an example to introduce the implementation of the classification module 710. Similarly, the implementation of the processing module 720 and the compilation construction module 730 can refer to the implementation of the classification module 710.
[0132] As an example of a software functional unit, the grading module 710 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the grading module 710 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.
[0133] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0134] As an example of a hardware functional unit, the classification module 710 may include at least one computing device, such as a server, etc. Alternatively, the classification module may also be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0135] The multiple computing devices included in the grading module 710 can be distributed in the same region or in different regions. The multiple computing devices included in the grading module 710 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the processing module 720 can be distributed in the same VPC or in multiple VPCs; the multiple computing devices included in the compilation and construction module 730 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0136] It should be noted that, in other embodiments, the grading module 710 can be used to execute any step in the compilation and construction method, the processing module 720 can be used to execute any step in the compilation and construction method, and the compilation and construction module 730 can be used to execute any step in the compilation and construction method. The steps that the grading module 710, the processing module 720, and the compilation and construction module 730 are responsible for implementing can be specified as needed. The grading module 710, the processing module 720, and the compilation and construction module 730 respectively implement different steps in the compilation and construction method to achieve all the functions of the compilation and construction device 700.
[0137] The present application also provides a computing device 800. Figure 8 As shown, the computing device 800 includes: a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, the memory 806, and the communication interface 808 communicate through the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 800.
[0138] The bus 802 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 802 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 802 may include a path for transmitting information between various components of the computing device 800 (eg, the memory 806, the processor 804, and the communication interface 808).
[0139] The processor 804 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0140] The memory 806 may include a volatile memory, such as a random access memory (RAM). The memory 806 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0141] The memory 806 stores executable program codes, and the processor 804 executes the executable program codes to respectively implement the functions of the aforementioned classification module 710, processing module 720 and compilation and construction module 730, thereby implementing the compilation and construction method. That is, the memory 806 stores instructions for executing the compilation and construction method.
[0142] The communication interface 808 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or communication networks.
[0143] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0144] like Fig. 9 As shown, the computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the compiling and building method.
[0145] In some embodiments, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the compiling and building method. In other words, the combination of one or more computing devices 800 may jointly execute instructions for executing the compiling and building method.
[0146] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the compiling and building apparatus. That is, the instructions stored in the memory 806 in different computing devices 800 can implement the functions of one or more modules in the grading module 710, the processing module 720 and the compiling and building module 730.
[0147] In some embodiments, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.10 A possible implementation is shown. Fig.10 As shown, two computing devices 800A and 800B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for executing the functions of the grading module 710. At the same time, the memory 806 in the computing device 800B stores instructions for executing the functions of the processing module 720 and the compiling and building module 730.
[0148] Fig.10 The connection method between the computing device clusters shown can be considered to be that the compilation and construction method provided in this application needs to determine the compilation and construction security level of each project in large quantities and compile and construct each project in large quantities, so it is considered to hand over the functions implemented by the processing module 720 and the compilation and construction module 730 to the computing device 800B for execution.
[0149] It should be understood that Fig.10 The functions of the computing device 800A shown in FIG. 8 may also be completed by multiple computing devices 800. Similarly, the functions of the computing device 800B may also be completed by multiple computing devices 800.
[0150] Fig.11 Schematic diagram of a system based on a cloud server system in an embodiment of the present application. Fig.11 As shown, the cloud management platform 1110 is used to manage the infrastructure that provides multiple cloud services. The infrastructure includes multiple cloud data centers, each cloud data center includes multiple servers, and each server includes cloud service resources to provide corresponding cloud services to tenants.
[0151] The cloud management platform 1110 provides an access interface (such as an interface or an application program interface (API)). The tenant can operate the client remote access access interface to register a cloud account and password on the cloud management platform and log in to the cloud management platform. After the cloud management platform successfully authenticates the cloud account and password, the tenant can further pay to select and purchase a virtual machine with specific specifications (processor, memory, disk) on the cloud management platform. After the payment is successful, the cloud management platform provides the remote login account and password of the purchased virtual machine. The client can remotely log in to the virtual machine and install and run the tenant's application in the virtual machine. The tenant of the cloud service can be an individual, enterprise, school, hospital, administrative agency, etc.
[0152] The functions of the cloud management platform 1110 include, but are not limited to, user console, computing management service, network management service, storage management service, authentication service, and image management service. The user console provides an interface or API to interact with tenants, the computing management service is used to manage servers running virtual machines and containers and bare metal servers, the network management service is used to manage network services (such as gateways, firewalls, etc.), the storage management service is used to manage storage services (such as data bucket services), the authentication service is used to manage tenant accounts and passwords, and the image management service is used to manage virtual machine images. Tenants can use the client 1130 to log in to the cloud management platform 1110 through the Internet 1120 to manage the rented cloud services.
[0153] For example, this application Figure 7 The compilation and construction apparatus shown can be applied to the cloud management platform 1110 or the cloud data center to implement the compilation and construction of the project. The cloud management platform 1110 or the cloud data center can execute Figures 3 to 5 The compilation and construction method shown
[0154] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be a software or program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the above-mentioned compilation and construction method.
[0155] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the above-mentioned compilation and construction method.
[0156] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several 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 methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
[0157] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present application.
Claims
1. A compiling and building method, characterized in that: include: The compiling and building device determines the compiling and building security level of each project in N projects, where N is a positive integer greater than or equal to 2; The compile and construct device determines at least two compile builders according to the compile and construct security levels of the N projects, wherein each of the at least two compile builders corresponds to at least one project of the N projects, any two compile builders of the at least two compile builders correspond to projects with different compile and construct security levels, and the at least two compile builders are isolated from each other; The compiling and constructing device compiles and constructs the N projects in the at least two compiling and constructing machines, wherein each of the N projects is compiled and constructed in a corresponding compiling and constructing machine.
2. The method according to claim 1, characterized in that The compiling and building device determines the compiling and building security level of each project in N projects, including: The compiling and building device determines a security level of a code repository associated with an nth project among the N projects, wherein a portion of or all of the code of the nth project comes from the code repository associated with the nth project, n=1,...,N; The compiling and building device determines the compiling and building security level of the nth project according to the security level of the code repository associated with the nth project.
3. The method according to claim 1 or 2, characterized in that: When the compilation and construction safety level of the first project meets a preset condition, the compilation builder corresponding to the first project is a compilation builder configured to prohibit parallel compilation and construction, and the first project is any one of the N projects; When the compilation and construction safety level of the first project does not meet the preset condition, the compilation builder corresponding to the first project is a compilation builder configured to allow parallel compilation and construction.
4. The method according to any one of claims 1 to 3, characterized in that The reference scope of the dependent code repository of the compilation builder corresponding to the second project corresponds to the compilation and construction security level of the second project, and the second project is any one of the N projects.
5. The method according to claim 1, characterized in that The compiling and building device determines the compiling and building security level of each project in N projects, including: The compiling and constructing device determines a security level of an nth item among the N items, where n=1,...,N; The compiling and building device determines that the compiling and building security level of the nth project is the security level of the nth project.
6. The method according to claim 1, characterized in that The compiling and building device determines the compiling and building security level of each project in N projects, including: The compiling and building device determines a security level of a code repository associated with an nth project among the N projects and a security level of the nth project, wherein a portion of or all of the code of the nth project comes from the code repository associated with the nth project, n=1, . . . , N; The compiling and building device determines the compiling and building security level of the nth project according to the security level of the code repository associated with the nth project and the security level of the nth project.
7. The method according to any one of claims 1 to 6, characterized in that: The method is applied to a cloud management platform or a cloud data center.
8. A compiling and constructing device, characterized in that: include: A grading module, for determining a compile build safety level of each of N projects, where N is a positive integer greater than or equal to 2; a processing module, configured to determine at least two compilation builders according to the compilation and construction safety levels of the N projects, wherein each of the at least two compilation builders corresponds to at least one project of the N projects, any two of the at least two compilation builders correspond to projects with different compilation and construction safety levels, and the at least two compilation builders are isolated from each other; A compiling and building module is used to compile and build the N projects in the at least two compiling and building tools, wherein each of the N projects is compiled and built in a corresponding compiling and building tool.
9. The device according to claim 8, characterized in that The classification module is specifically used for: Determine a security level of a code bin associated with an nth project among the N projects, wherein a portion of or all of the code of the nth project comes from the code bin associated with the nth project, n=1,...,N; Determine a compilation and construction security level of the nth project according to a security level of a code repository associated with the nth project.
10. The device according to claim 8 or 9, characterized in that When the compilation and construction safety level of the first project meets a preset condition, the compilation builder corresponding to the first project is a compilation builder configured to prohibit parallel compilation and construction, and the first project is any one of the N projects; When the compilation and construction safety level of the first project does not meet a preset condition, the compilation builder corresponding to the first project is a compilation builder configured to allow parallel compilation and construction.
11. The device according to any one of claims 8 to 10, characterized in that The reference scope of the dependent code repository of the compilation builder corresponding to the second project corresponds to the compilation and construction security level of the second project, and the second project is any one of the N projects.
12. The device according to claim 8, characterized in that The classification module is specifically used for: Determine a safety level of an nth item among the N items, where n=1,...,N; Determine that the compilation and construction security level of the nth project is the security level of the nth project.
13. The device according to claim 8, characterized in that The classification module is specifically used for: Determine a security level of a code bin associated with an n-th project among the N projects and a security level of the n-th project, wherein a portion or all of the code of the n-th project comes from the code bin associated with the n-th project, n=1,...,N; Determine a compilation and construction security level of the nth project according to a security level of a code repository associated with the nth project and a security level of the nth project.
14. The device according to any one of claims 8 to 13, characterized in that The device is applied to a cloud management platform or a cloud data center.
15. A computing device, characterized in that: The method comprises a processor and a memory, wherein the processor is configured to execute instructions stored in the memory so that the computing device executes the method according to any one of claims 1 to 7.
16. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 7.
17. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device, the computing device is caused to perform the method according to any one of claims 1 to 7.
18. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method according to any one of claims 1 to 7.
19. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, and when the computer program instructions are executed by a computing device, the computing device performs the method as claimed in any one of claims 1 to 7.
20. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster performs the method according to any one of claims 1 to 7.
