CN112114813B - Automatic generation method of yaml script based on production line - Google Patents

Automatic generation method of yaml script based on production line Download PDF

Info

Publication number
CN112114813B
CN112114813B CN202010980487.XA CN202010980487A CN112114813B CN 112114813 B CN112114813 B CN 112114813B CN 202010980487 A CN202010980487 A CN 202010980487A CN 112114813 B CN112114813 B CN 112114813B
Authority
CN
China
Prior art keywords
yaml
configuration
production line
template
pipeline
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010980487.XA
Other languages
Chinese (zh)
Other versions
CN112114813A (en
Inventor
刘琴琴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN202010980487.XA priority Critical patent/CN112114813B/en
Publication of CN112114813A publication Critical patent/CN112114813A/en
Application granted granted Critical
Publication of CN112114813B publication Critical patent/CN112114813B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • General Factory Administration (AREA)

Abstract

The invention discloses a method for automatically generating a yaml script based on a production line, and belongs to the technical field of automatic generation of yaml configuration files. The method comprises the following steps: configuring a template: compiling a pipeline configuration and a user parameter configuration by using json and jsonet, wherein the pipeline configuration and the user parameter configuration are used for calling different engineering types maven, golang and vue; establishing a production line, configuring warehouse, template and mirror image information, and generating production line parameters; the front end analyzes the configured template parameter content and automatically generates a yaml file; and initiating construction of the generated xml file on the clone platform, and verifying correctness of contents of the xml script. The invention is a method for automatically generating the yaml script based on the production line, and developers or operation and maintenance personnel do not need to use development tools or manually compile configuration files, thereby reducing the working intensity of project managers or operation and maintenance personnel in compiling configuration scripts and improving the development and release efficiency.

Description

Automatic generation method of yaml script based on production line
Technical Field
The invention relates to the technical field of automatic generation of a yaml configuration file, in particular to a method for automatically generating a yaml script based on a production line.
Background
The completion of a code project is usually completed by several teams or a plurality of team members in cooperation, at least once integration is needed every day, and compiling a configuration file script for project deployment is an indispensable and extremely important link in the face of the requirements of short project period, high code quality requirement, rapid iteration and rapid online. Whether the script configuration is correct or not is extremely important for the deployment and the functional use of the product. At present, the following problems exist in the script configuration process of an operation and maintenance or project manager:
1) the script compiling efficiency is low, and errors are easy to occur;
2) the script is generated, the automation is not realized, and the debugging period is longer;
3) the deployment of the codes is not timely and the efficiency is low;
4) code compilation, testing and deployment are not streamlined.
Disclosure of Invention
The invention aims to provide a method for automatically generating a yaml script based on a production line, which aims to solve the problems that script configuration is time-consuming and labor-consuming, compiling is easy to make mistakes and construction and deployment are not timely in the code development and submission processes.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for automatically generating a yaml script based on a production line comprises the following steps:
configuring a template: compiling a pipeline configuration and a user parameter configuration by using json and jsonet, wherein the pipeline configuration and the user parameter configuration are used for calling different engineering types maven, golang and vue; of course, the above three types are not limited; the configuration content of the template is not limited to compiling, building and deploying of the code.
Establishing a production line, configuring warehouse, template and mirror image information, and generating production line parameters;
the front end analyzes the configured template parameter content and automatically generates a yaml file;
and initiating construction of the generated xml file on the clone platform, and verifying correctness of contents of the xml script.
The invention combs and researches the problems that compiling yaml configuration files is time-consuming and easy to make mistakes in the continuous delivery process of codes. The invention discloses a method for automatically generating a yanml script based on a production line, wherein in the process of production line configuration and user parameter configuration, json/jsonet is used for carrying out combined processing on the script, a json library is used for generating target formats, the target formats comprise a json format and a yanml format, the json format is used for foreground display, and the yanml format is used by the production line. In the assembly line, the front end analyzes the content of the parameter template and automatically generates a yaml file by combining the flow template.
Furthermore, in a configuration template, different types of projects of maven, golang and vue are defined, and project packaging, mirror image construction and mirror image deployment methods are written in pipeline for calling in the pipeline.
Further, writing pipeline configuration and user parameter configuration by using json and jsonet includes: and generating target formats through a jsonnet library, wherein the target formats comprise json format and yaml format, the json format is used as foreground display, and the yaml format is used by the pipeline.
Compared with the prior art, the invention has the beneficial effects that:
the invention relates to a method for automatically generating a yaml script based on a production line, which does not need developers or operation and maintenance personnel to use development tools or manually write configuration files any more, and users only need to configure warehouse, template and mirror image information in the production line, and an interface automatically analyzes the configured content and automatically generates the yaml file corresponding to a project. The configuration file script is automatically generated, so that a good foundation is provided for the rapid release of the version, the working strength of a project manager or operation and maintenance personnel for compiling the configuration script is reduced, and the development and release efficiency is improved.
Drawings
Fig. 1 is a flowchart of a pipeline-based automatic generation method of a yaml script of the present invention.
Detailed Description
The present invention will be further described with reference to the following examples, which are intended to illustrate only some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, other embodiments used by those skilled in the art without any creative effort belong to the protection scope of the present invention.
Example 1:
as shown in fig. 1, according to an embodiment of the present invention, this embodiment discloses a method for automatically generating a yaml script based on a pipeline, and the specific implementation method includes the following steps:
the method comprises the following steps: configuring different templates, and compiling pipeline configuration and user parameter configuration by using JSON and JSONnet, wherein the configuration can be called by different engineering types maven, golang and vue;
step two: establishing a production line, configuring warehouse, template and mirror image information, and generating production line parameters;
1) the method comprises the following steps: get
Address:
http://api.pipeline-backend-dev.matrixcloud.io/api/v1/repo/user/{user}/namespaces
parameter rules: the user is a mandatory item, and the login account of the user is generally the prefix of the Changhong mailbox.
And acquiring a Git library name list owned by the specified login user by a GET method.
2) The method comprises the following steps: post
Address:
http://portal.changhong.io/console/pipeline/server/api/v1/pipeline_group/{pipeline_group}
parameters are as follows:
{creator_user_name:"qinqin.liu"
operator_user_name:"qinqin.liu"
pipeline_group_name:"group_20200723"
project_id:"0c67ee76-e752-480c-98bd-8b31ed08df73"
repo_name:"osc-sd-detection"
repo_owner:"qinqin.liu"}
and binding the pipeline group ID with the user and the Git warehouse through a Post method.
3) The method comprises the following steps: post
Address:
http://portal.changhong.io/console/pipeline/server/api/v1/pipeline/pipeline
parameters are as follows: { creator _ user _ name: "linking. wang", git _ group: "test",
git_repository:"single_maven_repo",id:3,
operator_user_name:"qinqin.liu",pipeline_group_id:6,
pipeline_group_name:"group_20200723",
pipeline_name:"single-repo-test",
pipeine _ param { \\\ \ global \ advanced \ { }, \\ \ common \ branch _ name \ name \ setting \ "\ id \ component _ type \ text _ area \ hint \ and … … … … }
And configuring warehouse, template and mirror image information through a Post method, and creating a production line.
Step three: the front end analyzes the content of the parameter template and automatically generates a yaml file by combining the flow template;
4) the method comprises the following steps: put
Address:
http://portal.changhong.io/console/pipeline/server/api/v1/yaml/tid/{tid}
parameters are as follows:
Figure BDA0002687336090000051
Figure BDA0002687336090000061
the json and jsonnet content is automatically converted to a Drone xml file by Put method.
Step four: and the generated xml file initiates construction on the clone platform, so that the xml script content is verified.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (2)

1. A method for automatically generating a yaml script based on a production line is characterized by comprising the following steps:
configuring a template: compiling assembly line configuration and user parameter configuration by using json and jsonet, and generating target formats including json format and yaml format by using a jsonet library, wherein the json format is used as foreground display, and the yaml format is used by an assembly line; the pipeline configuration and the user parameter configuration are used for calling different engineering types maven, golang and vue;
creating a production line, configuring warehouse, template and mirror image information, and generating production line parameters; the method specifically comprises the following steps: acquiring a Git library name list owned by a specified login user through a GET method; binding the pipeline group ID with the user and the Git warehouse together by a Post method; configuring warehouse, template and mirror image information by a Post method, and establishing a production line;
the front end analyzes the configured template parameter content and automatically generates a yaml file; the method specifically comprises the following steps: the json and jsonnet contents are automatically converted into a Drone Yaml file by a Put method;
and initiating construction of the generated xml file on the clone platform, and verifying correctness of contents of the xml script.
2. The method for automatically generating the yaml script based on the pipeline as claimed in claim 1, wherein in the configuration template, different types of projects of maven, golang and vue are defined, and project packaging, mirror image construction and mirror image deployment methods are written in pipeline for calling in the pipeline.
CN202010980487.XA 2020-09-17 2020-09-17 Automatic generation method of yaml script based on production line Active CN112114813B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010980487.XA CN112114813B (en) 2020-09-17 2020-09-17 Automatic generation method of yaml script based on production line

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010980487.XA CN112114813B (en) 2020-09-17 2020-09-17 Automatic generation method of yaml script based on production line

Publications (2)

Publication Number Publication Date
CN112114813A CN112114813A (en) 2020-12-22
CN112114813B true CN112114813B (en) 2022-06-03

Family

ID=73799849

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010980487.XA Active CN112114813B (en) 2020-09-17 2020-09-17 Automatic generation method of yaml script based on production line

Country Status (1)

Country Link
CN (1) CN112114813B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112685051A (en) * 2020-12-31 2021-04-20 北京华胜天成科技股份有限公司 Method, device, platform and storage medium for automatically executing shell script
CN113010473B (en) * 2021-03-05 2023-02-28 山东英信计算机技术有限公司 Method and equipment for editing YAML file

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110888657A (en) * 2019-11-28 2020-03-17 浪潮金融信息技术有限公司 Method for deploying microservice based on Groovy template engine

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8346756B2 (en) * 2007-08-31 2013-01-01 Microsoft Corporation Calculating valence of expressions within documents for searching a document index
CN109271170B (en) * 2018-09-05 2020-04-28 杭州数梦工场科技有限公司 Distributed system deployment method, system, electronic device and storage medium
CN110647332A (en) * 2019-09-30 2020-01-03 北京百度网讯科技有限公司 Software deployment method and device based on container cloud
CN111399856A (en) * 2020-03-11 2020-07-10 山东汇贸电子口岸有限公司 File configuration editing method and system in service deployment
CN111475260A (en) * 2020-04-10 2020-07-31 杭州趣维科技有限公司 Flexible CICD method based on jenkins and kubernets platform
CN111506304A (en) * 2020-04-21 2020-08-07 科大国创云网科技有限公司 Assembly line construction method and system based on parameter configuration

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110888657A (en) * 2019-11-28 2020-03-17 浪潮金融信息技术有限公司 Method for deploying microservice based on Groovy template engine

Also Published As

Publication number Publication date
CN112114813A (en) 2020-12-22

Similar Documents

Publication Publication Date Title
CN112114813B (en) Automatic generation method of yaml script based on production line
WO2021088909A1 (en) Method and system for assisting operator development
US20110083120A1 (en) Modeling and linking documents for packaged software application configuration
US20200241847A1 (en) Recipe program code generation method and recipe compiling cloud platform system
CN111208995A (en) Method, system, device and storage medium for automatically generating IBM host job
CN110968294B (en) Business domain model establishing system and method
US20180173520A1 (en) Transactional distributed data analysis and transformation
CN110659018A (en) Flow engine implementation method and device
EP3968145A1 (en) Apparatus and method for executing customized artificial intelligence production line, and device and medium
CN113505082B (en) Application program testing method and device
CN102262684A (en) Method and device for generating webpage page of mobile terminal
CN111078547A (en) Automatic testing framework system for PYTHON general APP software
CN114297056A (en) Automatic testing method and system
CN115344300A (en) Branch pipeline construction method, device, equipment and storage medium
CN105279032A (en) Method and apparatus for synchronizing interface message and javaBean
CN113448874A (en) Method and device for generating unit test script
CN114356430A (en) DAG (demand oriented architecture) dependency configuration tool based on airflow scheduling system
Dehghani et al. Towards modeling process mining for graphical editors
Xie et al. Design and implementation of bank financial business automation testing framework based on QTP
CN117539461A (en) Low-code platform for rapid development of medical informatization system
CN117874393B (en) Method and system for constructing SCA model engineering through XML file
US20230266965A1 (en) Software development environment
CN113282494B (en) Method for testing code generated by VAPS
CN112000366B (en) System parameter configuration method and device based on code generator
CN111221524B (en) Method and system for generating front-end module by one key

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant