Software article generation method and apparatus
By establishing software artifact format standards and automated scripts, the problems of low software artifact quality and efficiency were solved, enabling efficient and stable software artifact generation and deployment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LANGXIN DATA TECH CO LTD
- Filing Date
- 2022-08-18
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, the quality of software artifacts is greatly affected by the execution level and personal experience of developers, resulting in low production efficiency, unstable delivery standards, and high costs.
The software artifact format standard defines the file description and directory structure of the software artifact template. By compiling the source code, merging the template, compressing the file and writing digital signatures, and combining with automated scripts, the standardized generation and deployment of software artifacts are realized.
It improves the quality stability and production efficiency of software artifacts, reduces labor and time costs, and achieves standardization and security in the software artifact production process.
Smart Images

Figure CN115407971B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for generating software artifacts. Background Technology
[0002] Typically, after developers generate software artifacts through offline editing, they can distribute the installation packages of these software artifacts via email or FTP. Application users can then manually deploy these software artifacts to target electronic devices based on the installation packages.
[0003] However, in the process of generating software artifacts, the quality of the artifacts is significantly influenced by the developers' skill level and personal experience, which directly affect the delivery standards of the software artifacts. Furthermore, manually generating software artifacts requires substantial labor and time costs, resulting in low efficiency. Therefore, improving the quality stability and generation efficiency of software artifacts is a pressing technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] This invention provides a method and apparatus for generating software artifacts, which addresses the shortcomings of existing technologies where the quality of software artifacts is greatly affected by the execution level and personal experience of developers, and the low generation efficiency of software artifacts, thereby improving the quality stability and generation efficiency of software artifacts.
[0005] This invention provides a method for generating software artifacts, comprising:
[0006] Obtain the target source code and target software artifact template corresponding to the software artifact to be created;
[0007] Based on the target source code and the target software artifact template, the software artifact to be manufactured is generated;
[0008] The target software artifact template is generated based on the software artifact format standard; the software artifact format standard is used to define the file description and directory structure of the software artifact template; the file description includes artifact name definition, version definition, application parameter definition, and container extension parameter definition.
[0009] According to the software artifact generation method provided by the present invention, the step of generating the software artifact to be manufactured based on the target source code and the target software artifact template includes:
[0010] Compile the target source code to obtain the target source code executable program;
[0011] The target source code executable program and the target software artifact template are merged to obtain the artifact file of the software to be made;
[0012] Compress the product file to obtain the software product to be manufactured.
[0013] According to the software artifact generation method provided by the present invention, the naming definition of the artifact name includes: the name of the software artifact template must include a template identifier, a deployment mode identifier, and a version identifier arranged in sequence;
[0014] The template identifier, deployment mode, and version of the software artifact template are determined based on the artifact description file carried by the software artifact template.
[0015] According to the software artifact generation method provided by the present invention, after generating the software artifact to be manufactured, the method further includes:
[0016] A digital signature is written for the software artifact to be created based on the digital signature format specified in the software artifact format standard.
[0017] According to the software artifact generation method provided by the present invention, after writing a digital signature to the software artifact to be created, the method further includes:
[0018] The software artifacts to be created, which have digital signatures, are stored in the artifact file library.
[0019] The software artifact generation method provided by the present invention further includes:
[0020] Obtain the target software artifact from the artifact file library;
[0021] Execute the automated script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource.
[0022] According to the software artifact generation method provided by the present invention, when the deployment mode supported by the target software artifact is the host deployment mode, the step of executing the automated script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource includes:
[0023] Execute the automation script corresponding to the host deployment mode and replace the initial input variables in the automation script corresponding to the host deployment mode in order to deploy the target software artifact to the target resource;
[0024] The initial input variables for the automation scripts corresponding to the host deployment mode are predefined.
[0025] According to the software artifact generation method provided by the present invention, when the deployment mode supported by the target software artifact is a container deployment mode, the step of executing the automated script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource includes:
[0026] Obtain the image file corresponding to the target software artifact;
[0027] Execute the automation script corresponding to the container deployment mode and replace the initial input variables in the automation script corresponding to the container deployment mode in order to deploy the image file to the target resource;
[0028] The initial input parameters of the automation script corresponding to the container deployment mode are predefined.
[0029] According to the software artifact generation method provided by the present invention, when there are multiple target software artifacts, after obtaining the target software artifacts from the artifact file library, the method further includes:
[0030] The target software artifacts are combined into a software artifact group;
[0031] Execute the automated script corresponding to the deployment mode supported by the software artifact group to deploy the software artifact group to the target resource.
[0032] The present invention also provides a software artifact generation apparatus, comprising:
[0033] The data acquisition module is used to acquire the target source code and target software artifact template corresponding to the software artifact to be made;
[0034] The artifact generation module is used to generate the software artifact to be manufactured based on the target source code and the target software artifact template.
[0035] The target software artifact template is generated based on the software artifact format standard; the software artifact format standard is used to define the file description and directory structure of the software artifact template; the file description includes artifact name definition, version definition, application parameter definition, and container extension parameter definition.
[0036] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the software artifact generation method described above.
[0037] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the software artifact generation method as described above.
[0038] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the software artifact generation method described above.
[0039] The software artifact generation method and apparatus provided by this invention, after obtaining the target source code and target software artifact template corresponding to the software artifact to be created, generates the software artifact to be created based on the target source code and target software artifact template. The target software artifact template is generated based on the software artifact format standard, which is used to define the file description and directory structure of the software artifact template. The file description includes artifact name definition, version definition, application parameter definition, and container extension parameter definition. Based on the software artifact format standard, the process and method of software artifact generation can be standardized, avoiding the influence of developers' execution level and personal experience on the delivery standard of software artifacts, thereby improving the quality and stability of software artifacts, reducing the labor and time costs required to generate software artifacts, and improving the generation efficiency of software artifacts. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0041] Figure 1 This is one of the flowcharts illustrating the software artifact generation method provided by the present invention;
[0042] Figure 2 This is the second flowchart illustrating the software artifact generation method provided by the present invention;
[0043] Figure 3 This is a schematic diagram of the process of deploying software artifacts in the software artifact generation method provided by the present invention;
[0044] Figure 4 This is a schematic diagram of the process for generating a group of software artifacts in the software artifact generation method provided by the present invention;
[0045] Figure 5 This is a schematic diagram of the software artifact generation device provided by the present invention;
[0046] Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0048] In the description of the invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0049] It should be noted that the distribution of traditional software artifacts involves developers editing the software artifacts offline, including: program media, deployment scripts, and deployment instructions. After completing the offline editing of the traditional software artifacts, developers can collect and edit the distribution media, and distribute the installation packages of the aforementioned traditional software artifacts via email or FTP. Application users can then manually deploy the aforementioned traditional software artifacts to target electronic devices based on the installation packages.
[0050] However, the creation, distribution, and deployment of these traditional software products suffer from inconsistent installation media standards. During the distribution of installation packages, the lack of a standardized process and platform makes it easy for files to be lost or tampered with, compromising their integrity and security. Furthermore, achieving a unified process and configuration is difficult in the actual deployment of these traditional software products. Moreover, each traditional software product is released independently, and the developers' skill level and personal experience directly impact the delivery standards.
[0051] In response, this invention provides a method for generating software artifacts. Based on the technological development trend of building packages using code repositories and continuous integration tools, a software artifact format standard is established. Based on this standard, the process and method of generating, distributing, and deploying software artifacts can be standardized. This method can meet the software artifact specification requirements for host and containerized deployments. It provides a set of out-of-the-box standards and technical solutions for the generation, release, and deployment of software artifacts in development, testing, and operation environments. This helps product teams improve their product release and deployment processes and achieves standardization at each stage.
[0052] Figure 1This is one of the flowcharts illustrating the software artifact generation method provided by this invention. The following is a combination of... Figure 1 The method for generating software artifacts according to the present invention is described. For example... Figure 1 As shown, the method includes: step 101, obtaining the target source code and target software artifact template corresponding to the software artifact to be made.
[0053] The target software artifact template is generated based on the software artifact format standard; the software artifact format standard is used to define the file description and directory structure of the software artifact template; the file description includes the artifact name definition, version definition, application parameter definition, and container extension parameter definition.
[0054] It should be noted that the execution subject of this embodiment of the invention is a software artifact generation device.
[0055] Specifically, in this embodiment of the invention, the target source code and target software artifact template corresponding to the software artifact to be created can be obtained in various ways. For example, developers can write and input the target source code corresponding to the software artifact to be created based on the generation requirements of the software artifact to be created. Developers can also create and input the target software artifact template corresponding to the software artifact to be created based on the generation requirements of the software artifact to be created and the software artifact format standard. Thus, the target source code and target software artifact template corresponding to the software artifact to be created can be obtained based on the user's input. Alternatively, based on the generation requirements of the software artifact to be created, the target source code corresponding to the software artifact to be created can be found and obtained from the stored source code, and the target software indicator template corresponding to the software artifact to be created can be found and obtained from the stored software artifact templates created based on the software artifact format standard.
[0056] It should be noted that each application in the software artifact to be created can correspond to one target software artifact template, and each middleware in the software artifact to be created can also correspond to one target software artifact template. Therefore, the number of target software artifact templates corresponding to the software artifact to be created is related to the number of applications and middleware in the software artifact to be created.
[0057] Figure 2 This is the second flowchart illustrating the software artifact generation method provided by this invention. For example... Figure 2 As shown, in this embodiment of the invention, the target software artifact template corresponding to the software artifact to be created can be found and obtained from the software artifact templates stored in the software artifact template library based on the generation requirements of the software artifact to be created.
[0058] The software artifact templates stored in the software artifact template library can be created by developers based on software artifact format standards. After developers create various software artifact templates based on the software artifact format, they can upload the aforementioned software indicator templates to the software artifact template library for storage.
[0059] It is understandable that, given that all the software artifact templates stored in the software artifact template library are made based on the software artifact format standard, the target software artifact template corresponding to the software artifact to be made, which is found and obtained from the software artifact templates stored in the software artifact template library, is also made based on the software artifact format standard.
[0060] like Figure 2 As shown, in this embodiment of the invention, the target source code corresponding to the software artifact to be created can also be found and obtained from the source code stored in the source code library based on the generation requirements of the software artifact to be created.
[0061] The source code in the source code repository can be pre-written by developers. After writing the source code, developers can upload it to the source code repository for storage.
[0062] It should be noted that the software artifact format standard in this embodiment of the invention can be formulated based on prior knowledge and / or actual conditions. The aforementioned software artifact format standard can be used to define the file description and directory structure of the software artifact template, thereby enabling applications and middleware to be packaged into a software artifact template according to a standard format.
[0063] Based on the above embodiments, the naming definition of the artifact name includes: the name of the software artifact template must include a template identifier, a deployment mode identifier, and a version identifier arranged in sequence; the template identifier, deployment mode, and version of the software artifact template are determined based on the artifact description file carried by the software artifact template.
[0064] Optionally, software artifact format standards may include, but are not limited to, artifact file naming conventions and file format conventions, artifact file directory structure conventions, and artifact description file conventions.
[0065] The naming convention for artifact files includes a requirement that the name of a software artifact template must include a template identifier, a deployment mode identifier, and version information in sequential order. For example, the name of any software artifact template could be: [Artifact Name]_(dc|dm)[Artifact Version]. Here, the [Artifact Name] can be determined based on the `enName` in the artifact description file (product.json) included with the software artifact template, and the [Artifact Version] can be determined based on the `version` in the artifact description file. `dc` represents the container deployment mode, and `dm` represents the host deployment mode. The deployment mode of the software artifact template can be determined based on the artifact description file included with the software artifact template. Therefore, based on the name of any software artifact template, it is possible to quickly and accurately determine whether the software artifact template is intended for container deployment or host deployment.
[0066] It should be noted that the overall description of the product description document is shown in Table 1.
[0067] Table 1 Overall Description of the Product Description Document
[0068]
[0069] The artifact description file included with any software artifact template can serve as an outline for that template, describing its basic information (including deployment mode, standard template version, Chinese name of the artifact file, English name of the artifact file, artifact version, artifact version release notes, etc.) and application parameters, container extension parameters, and extended parameters. The artifact description file accompanying the software artifact template can clearly define the purpose of the software artifact template, its deployment mode, and related deployment mode definitions.
[0070] The artifact description file carried by any software artifact template is a JSON file. To facilitate conversion and meet the parameter validation requirements of the front-end and back-end, the param object specification is defined in this embodiment of the invention. This allows the definition and constraints of parameter values to be clearly defined when the artifact file is created, enhancing flexibility and scalability. The param object specification is described in Table 2.
[0071] Table 2 Specification of param object
[0072]
[0073] It should be noted that the software artifact template is in zip format.
[0074] When any software artifact template is deployed in container mode, the directory structure of the software artifact template is as follows: The [app] directory stores the files required for artifact deployment;
[0075] The properties directory stores files or PVC configuration descriptions that need to be mounted onto the container.
[0076] The `confspec` directory stores configuration files required for version deployment.
[0077] The `[script]` directory stores the deployment scripts required for version deployment;
[0078] The
setup
[0079] When any software artifact template is deployed in host deployment mode, the directory structure of the software artifact template is as follows: The
app
[0080] The `ansible` directory contains the installation, configuration, and runtime files for Ansible.
[0081] The `confspec` directory stores configuration files required for version deployment.
[0082] The `[script]` directory stores the deployment scripts required for version deployment;
[0083] Optionally, any software artifact template may also include an image description file (Dockerfile). The image description file included with any software artifact template can be used when generating an image file based on the software artifact template, and can be a predefined file.
[0084] Step 102: Generate the software artifact to be made based on the target source code and the target software artifact template.
[0085] Specifically, after obtaining the target source code and target software artifact template corresponding to the software artifact to be made, the software artifact to be made can be generated based on the target source code and target software artifact template.
[0086] This invention, through obtaining the target source code and target software artifact template corresponding to the software artifact to be created, generates the software artifact based on the target source code and target software artifact template. The target software artifact template is generated based on the software artifact format standard, which defines the file description and directory structure of the software artifact template. The file description includes artifact name definition, version definition, application parameter definition, and container extension parameter definition. Based on the software artifact format standard, the process and method of software artifact generation can be standardized, avoiding the influence of developers' execution level and personal experience on the delivery standard of the software artifact. This improves the quality and stability of the software artifact, reduces the labor and time costs required to generate the software artifact, and increases the generation efficiency of the software artifact.
[0087] Based on the above embodiments, and based on the target source code and the target software artifact template, a software artifact to be manufactured is generated, including: compiling the target source code and obtaining the target source code executable program.
[0088] Specifically, such as Figure 2 As shown, after obtaining the target source code corresponding to the software artifact to be created, the target source code can be compiled to obtain the target source code executable program.
[0089] Merge the target source code executable and the target software artifact template to obtain the artifact file for the software artifact to be created.
[0090] Specifically, such as Figure 2 As shown, after obtaining the target source code executable program, the binary file can be stored in the corresponding directory of the target software artifact template to merge the target source code executable program and the target software artifact template, thereby obtaining the artifact file of the software artifact to be created.
[0091] Compress the artifact files to obtain the software artifact to be created.
[0092] Specifically, such as Figure 2 As shown, after obtaining the artifact file of the software artifact to be created, the artifact file of the software artifact to be created can be compressed to obtain the software artifact to be created.
[0093] This invention, through compiling the target source code corresponding to the software artifact to be manufactured, obtains an executable program of the target source code file, merges the executable program of the target source code file and the target software artifact template corresponding to the software artifact to be manufactured, obtains the artifact file of the software artifact to be manufactured, compresses the artifact file, and obtains the software artifact to be manufactured. It can generate the software artifact to be manufactured more simply and efficiently based on the target source code and the target software artifact template corresponding to the software artifact to be manufactured.
[0094] Based on the above embodiments, after generating the software artifact to be manufactured, the method further includes: writing a digital signature on the software artifact to be manufactured based on the digital signature format specified in the software artifact format standard.
[0095] Optionally, the software artifact format standard may also include a software artifact digital signature format.
[0096] Specifically, such as Figure 2 As shown, in order to ensure the security of software artifacts and prevent them from being tampered with during distribution, after the software artifact to be created is generated, asymmetric encryption technology can be used to generate a corresponding digital signature for the software artifact to be created using a private key based on the digital signature format specified in the software artifact format standard, and the bytecode of the aforementioned digital signature can be written into the software artifact to be created.
[0097] This invention improves the security of the software artifact by writing a digital signature on it according to the digital signature format specified in the software artifact format standard after the software artifact is generated. This prevents the software artifact from being tampered with during distribution.
[0098] Based on the above embodiments, after writing a digital signature to the software artifact to be manufactured, the method further includes: storing the software artifact to be manufactured with the digital signature in the artifact file library.
[0099] Specifically, such as Figure 2 As shown, after writing a digital signature to the software artifact to be made, the digitally signed software artifact can be pushed to the artifact file library for classified storage according to the type and version of the software artifact to be made.
[0100] This invention, by storing software artifacts to be created with digital signatures, can standardize the process and method of software artifact distribution, and provide a set of out-of-the-box standards and technical solutions for the generation and release of software artifacts in development, testing and operation environments.
[0101] Based on the above embodiments, the method further includes: obtaining the target software artifact from the artifact file library.
[0102] Figure 3 This is a schematic diagram of the process for deploying software artifacts in the software artifact generation method provided by this invention. For example... Figure 3 As shown, when the deployment mode of the software artifact includes container deployment mode, when the software artifact enters the artifact file library, the image file (Docker) corresponding to the software artifact is generated based on the image description file carried by the software artifact, and the image file corresponding to the software artifact can be pushed to the container image library for storage.
[0103] In this embodiment of the invention, the target software artifact can be obtained from the software artifacts already stored in the container image library based on actual deployment requirements.
[0104] Execute the automated script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource.
[0105] Specifically, after obtaining the target software artifact from the container image repository, the target software artifact can be deployed.
[0106] During the deployment process, the target resources for deployment can be determined based on the deployment modes supported by the target software artifact (host deployment mode or image deployment mode).
[0107] The deployment process of the target software artifact is executed by an automated script corresponding to the deployment mode supported by the target software artifact. By executing the automated script corresponding to the deployment mode supported by the target software artifact, the target software artifact can be deployed to the target resource.
[0108] This invention, by retrieving the target software artifact from the software artifacts already stored in the container image repository and then executing the automated script corresponding to the deployment mode supported by the target software artifact, deploys the target software artifact to the target resource. This standardizes the process and method of software artifact deployment, meets the software artifact specification requirements for both host and container deployment modes, and improves the deployment efficiency and stability of software artifacts.
[0109] Based on the above embodiments, when the deployment modes supported by the target software artifact include the host deployment mode, executing the automation script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource includes: executing the automation script corresponding to the host deployment mode and replacing the initial input variables in the automation script corresponding to the host deployment mode to deploy the target software artifact to the target resource.
[0110] In the host deployment mode, the initial input variables for the automation scripts are predefined.
[0111] Specifically, such as Figure 3 As shown, when the target software artifact supports deployment modes including host deployment mode, the automation script corresponding to the host deployment mode can be executed, and the initial input variables in the aforementioned automation script can be replaced.
[0112] The aforementioned automated script can read a pre-set deployment pipeline template and deploy the target software artifact to the target resource according to the preset execution steps in the deployment pipeline template. The target resource can be a host server.
[0113] It should be noted that the initial input variables for the automation scripts corresponding to the host deployment mode can be predefined based on prior knowledge and / or actual conditions.
[0114] This invention, in the case where the target software artifact supports deployment modes including host deployment mode, executes the automated script corresponding to the host deployment mode and replaces the initial input variables in the automated script corresponding to the host deployment mode, so as to deploy the target software artifact to the target resource. This standardizes the process and method of deploying software artifacts in host deployment mode and enables more accurate and efficient deployment of software artifacts in host deployment mode.
[0115] Based on the above embodiments, when the deployment modes supported by the target software artifact include container deployment mode, executing the automated script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource includes: obtaining the image file corresponding to the target software artifact.
[0116] Specifically, such as Figure 3 As shown, if the target software artifact supports container deployment mode, the image file corresponding to the target software artifact can be found and obtained in the container image library.
[0117] Execute the automation script corresponding to the container deployment mode and replace the initial input variables in the automation script corresponding to the container deployment mode in order to deploy the image file to the target resource.
[0118] The initial input parameters for the automation scripts corresponding to the container deployment mode are predefined.
[0119] Specifically, such as Figure 3 As shown, after obtaining the image file corresponding to the target software artifact, the automated script corresponding to the container deployment mode can be executed, and the initial input variables in the above automated script can be replaced.
[0120] The aforementioned automated script can read a pre-defined deployment pipeline template and deploy the target software artifact to the target resource according to the preset execution steps in the deployment pipeline template. The target resource can be Kubernetes.
[0121] It's worth noting that Kubernetes, or K8s for short, is an abbreviation of "ubernete," which uses the number 8 to represent the eight characters in its name. It's an open-source application used to manage containerized applications across multiple hosts in a cloud platform.
[0122] It should be noted that the input and output variables of the automation scripts corresponding to the host deployment mode can be predefined based on prior knowledge and / or actual conditions.
[0123] Optionally, the initial input variables in the automation script corresponding to the container deployment mode include container parameter definitions, container extended parameter definitions, and application parameter definitions.
[0124] Container parameter definitions include the number of container replicas, container CPU upper and lower limits, container memory upper and lower limits, container environment variables, and startup parameters.
[0125] Container extended parameter definitions, including container access methods and container mount file configuration definitions.
[0126] Application parameter definitions include the definitions of dynamic variables in the mount file. These application parameters can be dynamically replaced when deploying the target software artifact.
[0127] This invention, when the target software artifact supports deployment modes including container deployment mode, obtains the image file corresponding to the target software artifact, executes the automated script corresponding to the container deployment mode, and replaces the initial input variables in the automated script corresponding to the container deployment mode, so as to deploy the image file corresponding to the target software artifact to the target resource. This standardizes the process and method of deploying software artifacts in container deployment mode, and enables more accurate and efficient deployment of software artifacts in container deployment mode.
[0128] Based on the above embodiments, when there are multiple target software artifacts, after obtaining the target software artifacts from the artifact file library, the method further includes: merging each target software artifact into a software artifact group.
[0129] Figure 3 This is a schematic diagram of the process for generating a group of software artifacts in the software artifact generation method provided by the present invention. For example... Figure 3 As shown, when multiple target software artifacts are obtained from the artifact file library, these target software artifacts can be merged into a software artifact group, thereby enabling the deployment of multiple software artifacts at once based on the software artifact group.
[0130] Execute the automation scripts corresponding to the deployment modes supported by the software artifact group to deploy the software artifact group to the target resource.
[0131] Specifically, during the deployment process, the software artifact group can determine the target resources for deployment based on the deployment modes (host deployment mode or image deployment mode) supported by the software artifact group.
[0132] The deployment process of software artifact groups is executed by automated scripts corresponding to the deployment modes supported by the software artifact group. By executing the automated scripts corresponding to the deployment modes supported by the software artifact group, the software artifact group can be deployed to the target resource.
[0133] Optionally, the deployed target software artifacts and / or groups of software artifacts can be stored in a central artifact repository. The central artifact repository can push the target software artifacts and / or groups of software artifacts to a local artifact repository for storage.
[0134] This invention, through merging multiple target software artifacts into a software artifact group, executes an automated script corresponding to the deployment mode supported by the software artifact group to deploy the software artifact group to the target resource. This enables the deployment of multiple software artifacts at once and improves the deployment efficiency of software artifacts.
[0135] Figure 5 This is a schematic diagram of the software artifact generation device provided by the present invention. The following is in conjunction with… Figure 5 The software artifact generation apparatus provided by this invention will be described below, and the software artifact generation method provided by this invention described above can be referred to in correspondence with it. For example... Figure 5 As shown, the device includes a data acquisition module 501 and a product generation module 502.
[0136] The data acquisition module 501 is used to acquire the target source code and target software artifact template corresponding to the software artifact to be made.
[0137] The artifact generation module 502 is used to generate the software artifact to be made based on the target source code and the target software artifact template.
[0138] The target software artifact template is generated based on the software artifact format standard; the software artifact format standard defines the file description and directory structure of the software artifact template; the file description includes the artifact name definition, version definition, application parameter definition, and container extension parameter definition.
[0139] Specifically, the data acquisition module 501 and the product generation module 502 are electrically connected.
[0140] The data acquisition module 501 can be used to acquire the target source code and target software artifact template corresponding to the software artifact to be created in various ways. For example, developers can write and input the target source code corresponding to the software artifact to be created based on the generation requirements of the software artifact to be created. Developers can also create and input the target software artifact template corresponding to the software artifact to be created based on the generation requirements of the software artifact to be created and the software artifact format standard. Thus, the target source code and target software artifact template corresponding to the software artifact to be created can be acquired based on the user's input. Alternatively, based on the generation requirements of the software artifact to be created, the target source code corresponding to the software artifact to be created can be searched and acquired from the stored source code, and the target software indicator template corresponding to the software artifact to be created can be searched and acquired from the stored software artifact templates created based on the software artifact format standard.
[0141] The artifact generation module 502 can be used to generate a software artifact to be made based on the target source code and the target software artifact template.
[0142] Optionally, the artifact generation module 502 can be specifically used to compile the target source code to obtain the target source code executable program; merge the target source code executable program and the target software artifact template to obtain the artifact file of the software to be made; and compress the artifact file to obtain the software artifact to be made.
[0143] Optionally, the software artifact generation apparatus may also include a signature writing module and a storage module.
[0144] The signature writing module can be used to write digital signatures for software artifacts to be created, based on the digital signature format specified in the software artifact format standard.
[0145] The storage module can be used to store software artifacts with digital signatures to be created into an artifact file library.
[0146] Optionally, the software artifact generation apparatus may also include a software deployment module.
[0147] The software deployment module can be used to obtain the target software artifact from the artifact file library; execute the automated script corresponding to the deployment mode supported by the target software artifact; and deploy the target software artifact to the target resource.
[0148] Optionally, the software deployment module may also include a host deployment unit and a container deployment unit.
[0149] When the target software artifact supports the host deployment mode, the host deployment unit can be used to execute the automation script corresponding to the host deployment mode and replace the initial input variables in the automation script corresponding to the host deployment mode in order to deploy the target software artifact to the target resource; wherein, the initial input variables of the automation script corresponding to the host deployment mode are predefined.
[0150] When the target software artifact supports container deployment mode, the container deployment unit can be used to obtain the image file corresponding to the target software artifact; execute the automation script corresponding to the container deployment mode, and replace the initial input variables in the automation script corresponding to the container deployment mode, so as to deploy the image file to the target resource; wherein, the initial input parameters of the automation script corresponding to the container deployment mode are predefined.
[0151] Optionally, the software deployment module may also include a merging unit.
[0152] The merging unit can be used to merge various target software artifacts into a software artifact group; execute the automation scripts corresponding to the deployment modes supported by the software artifact group, and deploy the software artifact group to the target resources.
[0153] Typically, software artifacts consist of a combination of various components such as applications, middleware, and software products.
[0154] The software artifact generation device in this embodiment of the invention can obtain a target software artifact template corresponding to the software artifact to be manufactured, generated based on the software artifact format standard. Then, based on the target software artifact template and the target source code corresponding to the software artifact to be manufactured, the application program, middleware, and software products in the software artifact to be manufactured can be packaged according to the software artifact format standard to generate the software artifact to be manufactured.
[0155] After generating the software artifact to be made, a digital signature can be written onto the software artifact to prevent it from being tampered with during transmission.
[0156] After writing a digital signature to the software artifact to be created, the software artifact can be stored in the artifact file library for deployment.
[0157] It should be noted that each software artifact in the artifact repository can support any number of versions existing simultaneously.
[0158] The software artifact generation apparatus in this embodiment of the invention can also select software artifacts or groups of software artifacts from the artifact file library for deployment.
[0159] Before deployment, the security of software artifacts or groups of software artifacts can be ensured by verifying digital signatures.
[0160] After successful verification, the formal deployment operation is performed. The deployment mode depends on the deployment mode of the software artifact or software artifact group. It can be selected to deploy directly to the host server or Kubernetes container, and finally the software artifact or software artifact group is deployed to the host server or Kubernetes container by executing an automated script.
[0161] The software artifact generation apparatus in this embodiment of the invention, after obtaining the target source code and target software artifact template corresponding to the software artifact to be manufactured, generates the software artifact to be manufactured based on the target source code and target software artifact template. The target software artifact template is generated based on the software artifact format standard. The software artifact format standard is used to define the file description and directory structure of the software artifact template. The file description includes artifact name definition, version definition, application parameter definition, and container extension parameter definition. Based on the software artifact format standard, the process and method of software artifact generation can be standardized, and the influence of the developer's execution level and personal experience on the delivery standard of the software artifact can be avoided. This can improve the quality stability of the software artifact, reduce the labor and time costs required to generate the software artifact, and improve the generation efficiency of the software artifact.
[0162] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640. The processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute a software artifact generation method. This method includes: obtaining the target source code and target software artifact template corresponding to the software artifact to be created; generating the software artifact to be created based on the target source code and target software artifact template; wherein the target software artifact template is generated based on a software artifact format standard; the software artifact format standard is used to define the file description and directory structure of the software artifact template; the file description includes artifact name definition, version definition, application parameter definition, and container extension parameter definition.
[0163] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0164] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the software artifact generation method provided by the above methods. The method includes: obtaining the target source code and the target software artifact template corresponding to the software artifact to be created; generating the software artifact to be created based on the target source code and the target software artifact template; wherein the target software artifact template is generated based on a software artifact format standard; the software artifact format standard is used to define the file description and directory structure of the software artifact template; the file description includes artifact name definition, version definition, application parameter definition, and container extension parameter definition.
[0165] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for generating software artifacts provided by the above methods. This method includes: obtaining target source code and a target software artifact template corresponding to the software artifact to be manufactured; generating the software artifact to be manufactured based on the target source code and the target software artifact template; wherein the target software artifact template is generated based on a software artifact format standard; the software artifact format standard is used to define the file description and directory structure of the software artifact template; the file description includes artifact name definition, version definition, application parameter definition, and container extension parameter definition.
[0166] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0167] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0168] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating software artifacts, characterized in that, include: Obtain the target source code and target software artifact template corresponding to the software artifact to be created; Based on the target source code and the target software artifact template, the software artifact to be manufactured is generated; The target software artifact template is generated based on the software artifact format standard. The software artifact format standard is used to define the file description and directory structure of the software artifact template. The file description includes artifact name definition, version definition, application parameter definition, and container extended parameter definition. The artifact name definition includes: the name of the software artifact template must include a template identifier, deployment mode identifier, and version identifier arranged in sequence. The deployment mode identifier is used to distinguish between container deployment mode and host deployment mode. Based on the digital signature format specified in the software artifact format standard, a digital signature is written for the software artifact to be created. The software artifacts to be created, which have digital signatures, are stored in the artifact file library.
2. The software artifact generation method according to claim 1, characterized in that, The step of generating the software artifact to be manufactured based on the target source code and the target software artifact template includes: Compile the target source code to obtain the target source code executable program; The target source code executable program and the target software artifact template are merged to obtain the artifact file of the software to be made; Compress the product file to obtain the software product to be manufactured.
3. The software artifact generation method according to claim 1, characterized in that, The template identifier, deployment mode, and version of the software artifact template are determined based on the artifact description file carried by the software artifact template.
4. The method for generating software artifacts according to claim 1, characterized in that, Also includes: Obtain the target software artifact from the artifact file library; Execute the automated script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource.
5. The method for generating software artifacts according to claim 4, characterized in that, When the target software artifact supports a host deployment mode, the step of executing the automated script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource includes: Execute the automation script corresponding to the host deployment mode and replace the initial input variables in the automation script corresponding to the host deployment mode in order to deploy the target software artifact to the target resource; The initial input variables for the automation scripts corresponding to the host deployment mode are predefined.
6. The method for generating software artifacts according to claim 4, characterized in that, When the target software artifact supports a container deployment mode, the step of executing the automated script corresponding to the deployment mode supported by the target software artifact to deploy the target software artifact to the target resource includes: Obtain the image file corresponding to the target software artifact; Execute the automation script corresponding to the container deployment mode and replace the initial input variables in the automation script corresponding to the container deployment mode in order to deploy the image file to the target resource; The initial input parameters of the automation script corresponding to the container deployment mode are predefined.
7. The method for generating software artifacts according to any one of claims 4 to 6, characterized in that, When there are multiple target software artifacts, after obtaining the target software artifacts from the artifact file library, the method further includes: The target software artifacts are combined into a software artifact group; Execute the automated script corresponding to the deployment mode supported by the software artifact group to deploy the software artifact group to the target resource.
8. A software artifact generation apparatus, characterized in that, include: The data acquisition module is used to acquire the target source code and target software artifact template corresponding to the software artifact to be made; The artifact generation module is used to generate the software artifact to be manufactured based on the target source code and the target software artifact template. The target software artifact template is generated based on the software artifact format standard. The software artifact format standard is used to define the file description and directory structure of the software artifact template. The file description includes artifact name definition, version definition, application parameter definition, and container extended parameter definition. The artifact name definition includes: the name of the software artifact template must include a template identifier, deployment mode identifier, and version identifier arranged in sequence. The deployment mode identifier is used to distinguish between container deployment mode and host deployment mode. Based on the digital signature format specified in the software artifact format standard, a digital signature is written for the software artifact to be created. The software artifacts to be created, which have digital signatures, are stored in the artifact file library.