From 6527603e24fc29a355e783692f1658924ec49c36 Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Tue, 14 Jul 2020 15:06:09 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E5=AE=8C=E5=96=84devops=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2731 +---------------- .../dev_ops/cloud_accounts_controller.rb | 11 +- .../dev_ops/languages_controller.rb | 20 + app/helpers/application_helper.rb | 5 + app/helpers/dev_ops/languages_helper.rb | 2 + app/libs/dev_ops/drone/ci.rb | 14 +- app/libs/dev_ops/drone/client.rb | 3 +- app/libs/dev_ops/drone/request.rb | 110 + app/libs/dev_ops/drone/server.rb | 8 +- app/models/dev_ops.rb | 5 + .../cloud_account.rb} | 4 +- app/models/dev_ops/language.rb | 15 + .../dev_ops/languages/common.json.jbuilder | 6 + .../dev_ops/languages/index.json.jbuilder | 6 + .../dev_ops/languages/show.json.jbuilder | 4 + config/routes.rb | 5 + ...20200710124116_create_dev_ops_languages.rb | 11 + ...713150706_create_dev_ops_cloud_accounts.rb | 14 + ...14513_add_cover_id_to_dev_ops_languages.rb | 5 + ...32759_drop_devops_clound_accounts_table.rb | 5 + lib/tasks/dev_ops_languages.rake | 715 +++++ 21 files changed, 1080 insertions(+), 2619 deletions(-) create mode 100644 app/controllers/dev_ops/languages_controller.rb create mode 100644 app/helpers/dev_ops/languages_helper.rb create mode 100644 app/libs/dev_ops/drone/request.rb create mode 100644 app/models/dev_ops.rb rename app/models/{devops_cloud_account.rb => dev_ops/cloud_account.rb} (88%) create mode 100644 app/models/dev_ops/language.rb create mode 100644 app/views/dev_ops/languages/common.json.jbuilder create mode 100644 app/views/dev_ops/languages/index.json.jbuilder create mode 100644 app/views/dev_ops/languages/show.json.jbuilder create mode 100644 db/migrate/20200710124116_create_dev_ops_languages.rb create mode 100644 db/migrate/20200713150706_create_dev_ops_cloud_accounts.rb create mode 100644 db/migrate/20200714014513_add_cover_id_to_dev_ops_languages.rb create mode 100644 db/migrate/20200714032759_drop_devops_clound_accounts_table.rb create mode 100644 lib/tasks/dev_ops_languages.rake diff --git a/README.md b/README.md index 61f68b32a..66bc49773 100644 --- a/README.md +++ b/README.md @@ -458,10 +458,9 @@ curl -X POST \ -d "clone_addr=https://gitea.com/mx8090alex/golden.git" \ -d "name=golden_mirror1" \ -d "description=golden_mirror" \ --d "repository_name=golden_mirror1" \ -d "project_category_id=1" \ -d "project_language_id=2" \ -http://localhost:3000/api/projects/migrate.json?debug=admin | jq +http://localhost:3000/api/projects/migrate.json | jq ``` *请求参数说明:* @@ -1874,2606 +1873,7 @@ http://localhost:3000/api/repositories/5845/commits/b0c4a4a1487d53acebf2addc544b } ], "IsIncomplete": false - }, - { - "Name": "docker-compose.yml", - "OldName": "docker-compose.yml", - "Index": 2, - "Addition": 42, - "Deletion": 0, - "Type": 1, - "IsCreated": true, - "IsDeleted": false, - "IsBin": false, - "IsLFSFile": false, - "IsRenamed": false, - "IsSubmodule": false, - "Sections": [ - { - "Name": "", - "Lines": [ - { - "LeftIdx": 0, - "RightIdx": 0, - "Type": 4, - "Content": "@@ -0,0 +1,42 @@", - "Comments": null, - "SectionInfo": { - "Path": "docker-compose.yml", - "LastLeftIdx": 0, - "LastRightIdx": 0, - "LeftIdx": 0, - "RightIdx": 1, - "LeftHunkSize": 0, - "RightHunkSize": 42 - } - }, - { - "LeftIdx": 0, - "RightIdx": 1, - "Type": 2, - "Content": "+version: '3.6'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 2, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 3, - "Type": 2, - "Content": "+services:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 4, - "Type": 2, - "Content": "+ web:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 5, - "Type": 2, - "Content": "+ build: .", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 6, - "Type": 2, - "Content": "+ command: sh -c \"/wait && java -jar /usr/local/markov-demo-0.0.1-SNAPSHOT.jar\"", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 7, - "Type": 2, - "Content": "+ environment:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 8, - "Type": 2, - "Content": "+ - WAIT_HOSTS=container-mysql:3306", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 9, - "Type": 2, - "Content": "+ - WAIT_HOSTS_TIMEOUT=300", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 10, - "Type": 2, - "Content": "+ - WAIT_SLEEP_INTERVAL=30", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 11, - "Type": 2, - "Content": "+ - WAIT_HOST_CONNECT_TIMEOUT=30", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 12, - "Type": 2, - "Content": "+ - spring.datasource.url=jdbc:mysql://container-mysql:3306/markov_demo?useUnicode=true&characterEncoding=utf-8", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 13, - "Type": 2, - "Content": "+ depends_on:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 14, - "Type": 2, - "Content": "+ - container-mysql", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 15, - "Type": 2, - "Content": "+ ports:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 16, - "Type": 2, - "Content": "+ - '8080:8080'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 17, - "Type": 2, - "Content": "+ expose:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 18, - "Type": 2, - "Content": "+ - '8080'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 19, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 20, - "Type": 2, - "Content": "+ container-mysql:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 21, - "Type": 2, - "Content": "+ image: mysql:5.7", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 22, - "Type": 2, - "Content": "+ restart: always", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 23, - "Type": 2, - "Content": "+ environment:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 24, - "Type": 2, - "Content": "+ MYSQL_DATABASE: 'markov_demo'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 25, - "Type": 2, - "Content": "+ # So you don't have to use root, but you can if you like", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 26, - "Type": 2, - "Content": "+ MYSQL_USER: 'root'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 27, - "Type": 2, - "Content": "+ # You can use whatever password you like", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 28, - "Type": 2, - "Content": "+ MYSQL_PASSWORD: '123'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 29, - "Type": 2, - "Content": "+ # Password for root access", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 30, - "Type": 2, - "Content": "+ MYSQL_ROOT_PASSWORD: '123'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 31, - "Type": 2, - "Content": "+ ports:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 32, - "Type": 2, - "Content": "+ # : < MySQL Port running inside container>", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 33, - "Type": 2, - "Content": "+ - '3306:3306'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 34, - "Type": 2, - "Content": "+ expose:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 35, - "Type": 2, - "Content": "+ # Opens port 3306 on the container", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 36, - "Type": 2, - "Content": "+ - '3306'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 37, - "Type": 2, - "Content": "+ # Where our data will be persisted", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 38, - "Type": 2, - "Content": "+ volumes:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 39, - "Type": 2, - "Content": "+ - my-db:/tmp/mysql", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 40, - "Type": 2, - "Content": "+# Names our volume", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 41, - "Type": 2, - "Content": "+volumes:", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 42, - "Type": 2, - "Content": "+ my-db: {}", - "Comments": null, - "SectionInfo": null - } - ] - } - ], - "IsIncomplete": false - }, - { - "Name": "pom.xml", - "OldName": "pom.xml", - "Index": 3, - "Addition": 5, - "Deletion": 0, - "Type": 2, - "IsCreated": false, - "IsDeleted": false, - "IsBin": false, - "IsLFSFile": false, - "IsRenamed": false, - "IsSubmodule": false, - "Sections": [ - { - "Name": "", - "Lines": [ - { - "LeftIdx": 0, - "RightIdx": 0, - "Type": 4, - "Content": "@@ -26,6 +26,11 @@", - "Comments": null, - "SectionInfo": { - "Path": "pom.xml", - "LastLeftIdx": 0, - "LastRightIdx": 0, - "LeftIdx": 26, - "RightIdx": 26, - "LeftHunkSize": 6, - "RightHunkSize": 11 - } - }, - { - "LeftIdx": 26, - "RightIdx": 26, - "Type": 1, - "Content": " \t\t\tmybatis-spring-boot-starter", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 27, - "RightIdx": 27, - "Type": 1, - "Content": " \t\t\t2.1.2", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 28, - "RightIdx": 28, - "Type": 1, - "Content": " \t\t", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 29, - "Type": 2, - "Content": "+\t\t", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 30, - "Type": 2, - "Content": "+\t\t\torg.flywaydb", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 31, - "Type": 2, - "Content": "+\t\t\tflyway-core", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 32, - "Type": 2, - "Content": "+\t\t\t6.4.2", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 33, - "Type": 2, - "Content": "+\t\t", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 29, - "RightIdx": 34, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 30, - "RightIdx": 35, - "Type": 1, - "Content": " \t\t", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 31, - "RightIdx": 36, - "Type": 1, - "Content": " \t\t\tmysql", - "Comments": null, - "SectionInfo": null - } - ] - }, - { - "Name": "", - "Lines": [ - { - "LeftIdx": 0, - "RightIdx": 0, - "Type": 4, - "Content": " ", - "Comments": null, - "SectionInfo": { - "Path": "pom.xml", - "LastLeftIdx": 31, - "LastRightIdx": 36, - "LeftIdx": 103, - "RightIdx": 108, - "LeftHunkSize": 0, - "RightHunkSize": 0 - } - } - ] - } - ], - "IsIncomplete": false - }, - { - "Name": "src/main/resources/application.properties", - "OldName": "src/main/resources/application.properties", - "Index": 4, - "Addition": 5, - "Deletion": 4, - "Type": 2, - "IsCreated": false, - "IsDeleted": false, - "IsBin": false, - "IsLFSFile": false, - "IsRenamed": false, - "IsSubmodule": false, - "Sections": [ - { - "Name": "", - "Lines": [ - { - "LeftIdx": 0, - "RightIdx": 0, - "Type": 4, - "Content": "@@ -1,10 +1,11 @@", - "Comments": null, - "SectionInfo": { - "Path": "src/main/resources/application.properties", - "LastLeftIdx": 0, - "LastRightIdx": 0, - "LeftIdx": 1, - "RightIdx": 1, - "LeftHunkSize": 10, - "RightHunkSize": 11 - } - }, - { - "LeftIdx": 1, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 1, - "Type": 2, - "Content": "+# Database configuration", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 2, - "RightIdx": 2, - "Type": 1, - "Content": " spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 3, - "RightIdx": 3, - "Type": 1, - "Content": " spring.datasource.url = jdbc:mysql://127.0.0.1:3306/markov_demo?useUnicode=true&characterEncoding=utf-8", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 4, - "RightIdx": 4, - "Type": 1, - "Content": " spring.datasource.username = root", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 5, - "RightIdx": 5, - "Type": 1, - "Content": " spring.datasource.password = 123", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 6, - "RightIdx": 6, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 7, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 8, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 9, - "RightIdx": 0, - "Type": 3, - "Content": "-mybatis.mapper-locations= classpath:mapping/*Mapper.xml", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 7, - "Type": 2, - "Content": "+mybatis.mapper-locations=classpath:mapping/*Mapper.xml", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 10, - "RightIdx": 8, - "Type": 1, - "Content": " mybatis.type-aliases-package=com.alibaba.markovdemo.entity", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 9, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 10, - "Type": 2, - "Content": "+spring.flyway.default-schema=markov_demo", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 11, - "Type": 2, - "Content": "+spring.flyway.locations=classpath:db/migration", - "Comments": null, - "SectionInfo": null - } - ] - } - ], - "IsIncomplete": false - }, - { - "Name": "src/main/resources/db/migration/V1__init_ddl.sql", - "OldName": "src/main/resources/db/migration/V1__init_ddl.sql", - "Index": 5, - "Addition": 179, - "Deletion": 0, - "Type": 1, - "IsCreated": true, - "IsDeleted": false, - "IsBin": false, - "IsLFSFile": false, - "IsRenamed": false, - "IsSubmodule": false, - "Sections": [ - { - "Name": "", - "Lines": [ - { - "LeftIdx": 0, - "RightIdx": 0, - "Type": 4, - "Content": "@@ -0,0 +1,179 @@", - "Comments": null, - "SectionInfo": { - "Path": "src/main/resources/db/migration/V1__init_ddl.sql", - "LastLeftIdx": 0, - "LastRightIdx": 0, - "LeftIdx": 0, - "RightIdx": 1, - "LeftHunkSize": 0, - "RightHunkSize": 179 - } - }, - { - "LeftIdx": 0, - "RightIdx": 1, - "Type": 2, - "Content": "+create database if not exists markov_demo;", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 2, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 3, - "Type": 2, - "Content": "+use markov_demo;", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 4, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 5, - "Type": 2, - "Content": "+CREATE TABLE `got_testcase` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 6, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 7, - "Type": 2, - "Content": "+ `scenario_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'scenario id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 8, - "Type": 2, - "Content": "+ `gmt_create` datetime DEFAULT NULL COMMENT '创建时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 9, - "Type": 2, - "Content": "+ `gmt_modified` datetime DEFAULT NULL COMMENT '修改时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 10, - "Type": 2, - "Content": "+ `name` longtext COMMENT 'name',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 11, - "Type": 2, - "Content": "+ `description` longtext COMMENT 'description',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 12, - "Type": 2, - "Content": "+ `long_description` longtext COMMENT '详细描述',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 13, - "Type": 2, - "Content": "+ `content` longtext COMMENT '存储case的阶段数据,比如数据准备阶段,数据执行阶段',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 14, - "Type": 2, - "Content": "+ `case_group` varchar(100) DEFAULT NULL COMMENT 'case分组',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 15, - "Type": 2, - "Content": "+ `is_deleted` int(11) DEFAULT '0' COMMENT '用例是否被删除。0-没有删除;1-已删除,此类case不会展示到页面上',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 16, - "Type": 2, - "Content": "+ `case_template` text COMMENT '用例模板 java/c++',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 17, - "Type": 2, - "Content": "+ `features` text COMMENT '业务特征',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 18, - "Type": 2, - "Content": "+ `is_visible` int DEFAULT '0' COMMENT '是否可见用例',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 19, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 20, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='testcase';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 21, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 22, - "Type": 2, - "Content": "+CREATE TABLE `got_pipeline` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 23, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键(id)',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 24, - "Type": 2, - "Content": "+ `pipeline` longtext COMMENT 'pipeline的json配置',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 25, - "Type": 2, - "Content": "+ `extend` text COMMENT '扩展字段',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 26, - "Type": 2, - "Content": "+ `tag` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '流程定义/自定义\\n',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 27, - "Type": 2, - "Content": "+ `scenario_id` bigint(20) unsigned DEFAULT NULL COMMENT '场景id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 28, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 29, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='存储流程执行的pipeline配置文件';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 30, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 31, - "Type": 2, - "Content": "+CREATE TABLE `got_scenario` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 32, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 33, - "Type": 2, - "Content": "+ `name` varchar(100) DEFAULT NULL COMMENT 'name',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 34, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 35, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='测试场景表';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 36, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 37, - "Type": 2, - "Content": "+CREATE TABLE `got_envs` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 38, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 39, - "Type": 2, - "Content": "+ `gmt_create` datetime DEFAULT NULL COMMENT '创建时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 40, - "Type": 2, - "Content": "+ `gmt_modified` datetime DEFAULT NULL COMMENT '修改时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 41, - "Type": 2, - "Content": "+ `host_ip` varchar(20) DEFAULT NULL COMMENT 'host_ip',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 42, - "Type": 2, - "Content": "+ `status` varchar(20) DEFAULT NULL COMMENT '状态',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 43, - "Type": 2, - "Content": "+ `name` varchar(200) DEFAULT NULL COMMENT '环境名称',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 44, - "Type": 2, - "Content": "+ `env_detail` text COMMENT '环境详情',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 45, - "Type": 2, - "Content": "+ `scenario_id` bigint(20) unsigned DEFAULT NULL COMMENT '场景id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 46, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 47, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=6928 DEFAULT CHARSET=utf8 COMMENT='环境列表';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 48, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 49, - "Type": 2, - "Content": "+CREATE TABLE `pipeline_ui` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 50, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 51, - "Type": 2, - "Content": "+ `scenario_id` bigint(20) unsigned DEFAULT NULL COMMENT '场景id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 52, - "Type": 2, - "Content": "+ `content` text COMMENT 'pipeline_ui的jsonString\\n',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 53, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 54, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='pipeline_ui表';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 55, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 56, - "Type": 2, - "Content": "+CREATE TABLE `got_datasource` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 57, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键/场景id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 58, - "Type": 2, - "Content": "+ `content` longtext COMMENT '数据源内容',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 59, - "Type": 2, - "Content": "+ `scenario_id` bigint(20) unsigned DEFAULT NULL COMMENT '场景id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 60, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`),", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 61, - "Type": 2, - "Content": "+ KEY `idx_scenario_id` (`scenario_id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 62, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='测试数据源表';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 63, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 64, - "Type": 2, - "Content": "+CREATE TABLE `got_menu` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 65, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 66, - "Type": 2, - "Content": "+ `content` text COMMENT 'menu的jsonString\\n',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 67, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 68, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='menu表';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 69, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 70, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 71, - "Type": 2, - "Content": "+insert into got_menu values(0, \"{ \\\"buinfo\\\": { \\\"buid\\\": 1, \\\"appSecneMap\\\": { \\\"1\\\": \\\"1\\\" }, \\\"menu\\\": [{ \\\"businessId\\\": 1, \\\"businessName\\\": \\\"markov-demo\\\", \\\"appMenuList\\\": [{ \\\"appName\\\": \\\"测试模块\\\", \\\"appId\\\": 1, \\\"scenarioMenuList\\\": [{ \\\"isMember\\\": true, \\\"scenarioId\\\": 1, \\\"scenarioName\\\": \\\"场景1\\\" },{ \\\"isMember\\\": true, \\\"scenarioId\\\": 2, \\\"scenarioName\\\": \\\"场景2\\\" }] }] }, ], \\\"buName\\\": \\\"markov-demo\\\" }}\");", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 72, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 73, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 74, - "Type": 2, - "Content": "+CREATE TABLE `got_reports` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 75, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 76, - "Type": 2, - "Content": "+ `gmt_create` datetime NOT NULL COMMENT '创建时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 77, - "Type": 2, - "Content": "+ `gmt_modified` datetime NOT NULL COMMENT '修改时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 78, - "Type": 2, - "Content": "+ `user` text COMMENT '执行用户',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 79, - "Type": 2, - "Content": "+ `report_name` text COMMENT '报告名称',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 80, - "Type": 2, - "Content": "+ `status` varchar(100) DEFAULT NULL COMMENT '执行状态',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 81, - "Type": 2, - "Content": "+ `message` text COMMENT '信息',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 82, - "Type": 2, - "Content": "+ `app_id` bigint(20) unsigned DEFAULT NULL COMMENT 'appid',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 83, - "Type": 2, - "Content": "+ `scenario_id` bigint(20) unsigned DEFAULT NULL COMMENT '场景id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 84, - "Type": 2, - "Content": "+ `run_type` text COMMENT '执行方式',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 85, - "Type": 2, - "Content": "+ `exec_id` text COMMENT '批次id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 86, - "Type": 2, - "Content": "+ `analysis` text COMMENT '分析报告',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 87, - "Type": 2, - "Content": "+ `task_id` text COMMENT 'zk任务id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 88, - "Type": 2, - "Content": "+ `zk_info` longtext COMMENT 'zk信息',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 89, - "Type": 2, - "Content": "+ `accuracy_report_id` bigint(20) unsigned DEFAULT NULL COMMENT '精准测试报告id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 90, - "Type": 2, - "Content": "+ `case_num` int(10) unsigned DEFAULT '0' COMMENT '回归用例数',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 91, - "Type": 2, - "Content": "+ `image_name` text COMMENT '回归的镜像版本',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 92, - "Type": 2, - "Content": "+ `branch_name` text COMMENT '执行用例的分支',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 93, - "Type": 2, - "Content": "+ `git_branch` text COMMENT '测试源码的分支',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 94, - "Type": 2, - "Content": "+ `git_commit` text COMMENT '测试源码的commit版本',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 95, - "Type": 2, - "Content": "+ `cc_cov_rate` text COMMENT '增量代码覆盖率',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 96, - "Type": 2, - "Content": "+ `is_visible` int DEFAULT '0' COMMENT '是否可见报告',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 97, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`),", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 98, - "Type": 2, - "Content": "+ KEY `idx_scenarioid` (`scenario_id`),", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 99, - "Type": 2, - "Content": "+ KEY `idx_appid` (`app_id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 100, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=7858 DEFAULT CHARSET=utf8mb4 COMMENT='回归测试报告表';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 101, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 102, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 103, - "Type": 2, - "Content": "+CREATE TABLE `got_testcase_snaps` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 104, - "Type": 2, - "Content": "+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 105, - "Type": 2, - "Content": "+ `gmt_create` datetime NOT NULL COMMENT '创建时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 106, - "Type": 2, - "Content": "+ `gmt_modified` datetime NOT NULL COMMENT '修改时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 107, - "Type": 2, - "Content": "+ `scenario_id` bigint(20) unsigned DEFAULT NULL COMMENT '场景id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 108, - "Type": 2, - "Content": "+ `app_id` bigint(20) unsigned DEFAULT NULL COMMENT 'appid',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 109, - "Type": 2, - "Content": "+ `name` varchar(100) DEFAULT NULL COMMENT '用例名',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 110, - "Type": 2, - "Content": "+ `description` text COMMENT '描述',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 111, - "Type": 2, - "Content": "+ `long_description` longtext COMMENT '详情',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 112, - "Type": 2, - "Content": "+ `content` longtext COMMENT '输入,输出,期望,数据准备',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 113, - "Type": 2, - "Content": "+ `status` varchar(100) DEFAULT NULL COMMENT '用例执行状态',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 114, - "Type": 2, - "Content": "+ `testreport_id` bigint(20) unsigned NOT NULL COMMENT '归属的报告id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 115, - "Type": 2, - "Content": "+ `testcase_id` bigint(20) unsigned NOT NULL COMMENT '归属的用例id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 116, - "Type": 2, - "Content": "+ `case_group` varchar(100) DEFAULT NULL COMMENT '测试用例分组',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 117, - "Type": 2, - "Content": "+ `tag` varchar(100) DEFAULT NULL COMMENT 'case标签,可有有多个值',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 118, - "Type": 2, - "Content": "+ `version` varchar(100) DEFAULT NULL COMMENT 'case版本号',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 119, - "Type": 2, - "Content": "+ `run_time` bigint(20) unsigned DEFAULT NULL COMMENT '执行时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 120, - "Type": 2, - "Content": "+ `run_time_str` text COMMENT '执行时间标准化',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 121, - "Type": 2, - "Content": "+ `retry_num` bigint(20) unsigned DEFAULT NULL COMMENT '重试次数',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 122, - "Type": 2, - "Content": "+ `constancy` text COMMENT '稳定性',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 123, - "Type": 2, - "Content": "+ `env_name` text COMMENT '环境名',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 124, - "Type": 2, - "Content": "+ `conflict_desc` text COMMENT '冲突用例描述',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 125, - "Type": 2, - "Content": "+ `is_parallel` tinyint(1) DEFAULT NULL COMMENT '是否串行',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 126, - "Type": 2, - "Content": "+ `trouble_shoot_box` longtext COMMENT '智能归因',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 127, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`),", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 128, - "Type": 2, - "Content": "+ KEY `idx_caseid` (`testcase_id`),", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 129, - "Type": 2, - "Content": "+ KEY `idx_reportid` (`testreport_id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 130, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=303953 DEFAULT CHARSET=utf8mb4 COMMENT='测试报告用例集快照'", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 131, - "Type": 2, - "Content": "+;", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 132, - "Type": 2, - "Content": "+CREATE TABLE `got_features_pool` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 133, - "Type": 2, - "Content": "+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 134, - "Type": 2, - "Content": "+ `gmt_create` datetime NOT NULL COMMENT '创建时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 135, - "Type": 2, - "Content": "+ `gmt_modified` datetime NOT NULL COMMENT '修改时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 136, - "Type": 2, - "Content": "+ `scenario_id` bigint unsigned NULL COMMENT 'scenario_id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 137, - "Type": 2, - "Content": "+ `app_id` bigint unsigned NULL COMMENT 'app_id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 138, - "Type": 2, - "Content": "+ `features` text NULL COMMENT '特征集',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 139, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 140, - "Type": 2, - "Content": "+) DEFAULT CHARACTER SET=utf8mb4 COMMENT='特征池';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 141, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 142, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 143, - "Type": 2, - "Content": "+CREATE TABLE `got_case_generate_task` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 144, - "Type": 2, - "Content": "+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 145, - "Type": 2, - "Content": "+ `gmt_create` datetime NOT NULL COMMENT '创建时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 146, - "Type": 2, - "Content": "+ `gmt_modified` datetime NOT NULL COMMENT '修改时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 147, - "Type": 2, - "Content": "+ `creator` text COMMENT '任务创建者',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 148, - "Type": 2, - "Content": "+ `seed_case_list` text COMMENT '种子用例id列表,以”,“分隔',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 149, - "Type": 2, - "Content": "+ `scenario_id` bigint unsigned DEFAULT NULL COMMENT '场景id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 150, - "Type": 2, - "Content": "+ `env_info` text COMMENT '测试环境信息',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 151, - "Type": 2, - "Content": "+ `feature_conf` longtext COMMENT '任务相关配置,jsonObject',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 152, - "Type": 2, - "Content": "+ `task_name` text COMMENT '任务名',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 153, - "Type": 2, - "Content": "+ `task_snap` longtext COMMENT '任务生成信息',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 154, - "Type": 2, - "Content": "+ `task_result` longtext COMMENT '最终生成用例',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 155, - "Type": 2, - "Content": "+ `task_status` text COMMENT 'crate 、executing、success or fail ',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 156, - "Type": 2, - "Content": "+ `gene_bank_snap` longtext COMMENT 'json格式gene bank',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 157, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 158, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=98 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='用例智能生成任务记录表';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 159, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 160, - "Type": 2, - "Content": "+CREATE TABLE `got_case_accuracy` (", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 161, - "Type": 2, - "Content": "+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 162, - "Type": 2, - "Content": "+ `gmt_create` datetime NOT NULL COMMENT '创建时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 163, - "Type": 2, - "Content": "+ `gmt_modified` datetime NOT NULL COMMENT '修改时间',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 164, - "Type": 2, - "Content": "+ `case_id` bigint unsigned DEFAULT NULL COMMENT 'case id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 165, - "Type": 2, - "Content": "+ `exe_id` bigint unsigned DEFAULT NULL COMMENT '回归执行id',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 166, - "Type": 2, - "Content": "+ `cov_line` longtext COMMENT 'case覆盖的代码行,json格式',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 167, - "Type": 2, - "Content": "+ `collect_type` text COMMENT 'single : 单case收集;total:任务整体收集',", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 168, - "Type": 2, - "Content": "+ PRIMARY KEY (`id`),", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 169, - "Type": 2, - "Content": "+ KEY `idx_caseid` (`case_id`),", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 170, - "Type": 2, - "Content": "+ KEY `idx_exe_id` (`exe_id`)", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 171, - "Type": 2, - "Content": "+) ENGINE=InnoDB AUTO_INCREMENT=16001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='case精准数据覆盖数据记录表';", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 172, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 173, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 174, - "Type": 2, - "Content": "+INSERT INTO `got_testcase` (`gmt_create`,`gmt_modified`,`scenario_id`,`name`,`description`,`long_description`,`content`,`case_group`,`is_deleted`,`case_template`,`is_visible`) VALUES ('2020-04-28 19:12:55','2020-04-28 19:12:55',1,'case名','用例智能生成-种子用例','种子用例','{\\\"prepareData\\\":[{\\\"Tair\\\":[{\\\"dsName\\\":\\\"table.markovtair.test\\\",\\\"data\\\":[{\\\"key\\\":\\\"testkey\\\",\\\"value\\\":\\\"testvalue\\\",\\\"property\\\":\\\"\\\"}]}]}],\\\"caseRunStage\\\":[{\\\"group_name\\\":\\\"ERPC校验(第一组)\\\",\\\"data\\\":[{\\\"input\\\":\\\"{\\\\n \\\\\\\"ad_id\\\\\\\": \\\\\\\"222\\\\\\\",\\\\n \\\\\\\"search_key\\\\\\\": \\\\\\\"key1\\\\\\\",\\\\n \\\\\\\"match_level\\\\\\\": 2,\\\\n \\\\\\\"user_type\\\\\\\": \\\\\\\"type1\\\\\\\",\\\\n \\\\\\\"top_num\\\\\\\": 10,\\\\n \\\\\\\"use_feature\\\\\\\": false,\\\\n \\\\\\\"other1\\\\\\\": \\\\\\\"1\\\\\\\",\\\\n \\\\\\\"other2\\\\\\\": \\\\\\\"0\\\\\\\"\\\\n}\\\",\\\"expect\\\":\\\"{\\\\n \\\\\\\"result\\\\\\\": \\\\\\\"1\\\\\\\" \\\\n}\\\",\\\"actual\\\":\\\"null\\\"}]}]}','test',0,'c++',0);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 175, - "Type": 2, - "Content": "+INSERT INTO `got_testcase` (`gmt_create`,`gmt_modified`,`scenario_id`,`name`,`description`,`long_description`,`content`,`case_group`,`is_deleted`,`case_template`,`is_visible`) VALUES ('2020-04-28 19:12:55','2020-04-28 19:12:55',1,'case名','用例智能推荐用例1','普通用例','{\\\"prepareData\\\":[{\\\"Tair\\\":[{\\\"dsName\\\":\\\"table.markovtair.test\\\",\\\"data\\\":[{\\\"key\\\":\\\"testkey\\\",\\\"value\\\":\\\"testvalue\\\",\\\"property\\\":\\\"\\\"}]}],\\\"Imock\\\":[{\\\"dsName\\\":\\\"erpc_merger_inner\\\",\\\"data\\\":[{\\\"key\\\":\\\"key1\\\",\\\"value\\\":\\\"value1\\\",\\\"property\\\":\\\"\\\"},{\\\"key\\\":\\\"key2\\\",\\\"value\\\":\\\"value2\\\",\\\"property\\\":\\\"\\\"}],\\\"restartFlag\\\":\\\"0\\\"}]}],\\\"caseRunStage\\\":[{\\\"group_name\\\":\\\"ERPC校验(第一组)\\\",\\\"data\\\":[{\\\"input\\\":\\\"{\\\\n \\\\\\\"param_manager\\\\\\\": {\\\\n \\\\\\\"expand_param\\\\\\\": {\\\\n \\\\\\\"key_value_list\\\\\\\": [\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature1\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"true\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature2\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"3,8;4,16\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature3\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"1\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature4\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"one_phase_model_searching,200,166,1\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature5\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"false\\\\\\\"\\\\n }\\\\n ]\\\\n }\\\\n }\\\\n}\\\",\\\"expect\\\":\\\"{\\\\n \\\\\\\"result\\\\\\\": \\\\\\\"1\\\\\\\"\\\\n}\\\",\\\"actual\\\":\\\"null\\\"}]}]}','猜你喜欢',0,'c++',0);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 176, - "Type": 2, - "Content": "+INSERT INTO `got_testcase` (`gmt_create`,`gmt_modified`,`scenario_id`,`name`,`description`,`long_description`,`content`,`case_group`,`is_deleted`,`case_template`,`is_visible`) VALUES ('2020-04-28 19:12:55','2020-04-28 19:12:55',1,'case名','用例智能推荐用例2','普通用例','{\\\"prepareData\\\":[{\\\"Tair\\\":[{\\\"dsName\\\":\\\"table.markovtair.test\\\",\\\"data\\\":[{\\\"key\\\":\\\"testkey\\\",\\\"value\\\":\\\"testvalue\\\",\\\"property\\\":\\\"\\\"}]}],\\\"Imock\\\":[{\\\"dsName\\\":\\\"erpc_merger_inner\\\",\\\"data\\\":[{\\\"key\\\":\\\"key1\\\",\\\"value\\\":\\\"confict-value\\\",\\\"property\\\":\\\"\\\"},{\\\"key\\\":\\\"key2\\\",\\\"value\\\":\\\"value2\\\",\\\"property\\\":\\\"\\\"}]}]}],\\\"caseRunStage\\\":[{\\\"group_name\\\":\\\"ERPC校验(第一组)\\\",\\\"data\\\":[{\\\"input\\\":\\\"{\\\\n \\\\\\\"param_manager\\\\\\\": {\\\\n \\\\\\\"expand_param\\\\\\\": {\\\\n \\\\\\\"key_value_list\\\\\\\": [\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature1\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"true\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature2\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"3,8;4,16\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature3\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"1\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature4\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"one_phase_model_searching,200,166,1\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature5\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"false\\\\\\\"\\\\n }\\\\n ]\\\\n }\\\\n }\\\\n}\\\",\\\"expect\\\":\\\"{\\\\n \\\\\\\"result\\\\\\\": \\\\\\\"1\\\\\\\"\\\\n}\\\"}]}]}','购物车',0,'c++',0);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 177, - "Type": 2, - "Content": "+INSERT INTO `got_testcase` (`gmt_create`,`gmt_modified`,`scenario_id`,`name`,`description`,`long_description`,`content`,`case_group`,`is_deleted`,`case_template`,`is_visible`) VALUES ('2020-04-28 19:12:55','2020-04-28 19:12:55',1,'case名','用例智能推荐用例3','普通用例','{\\\"prepareData\\\":[{\\\"Tair\\\":[{\\\"dsName\\\":\\\"table.markovtair.test\\\",\\\"data\\\":[{\\\"key\\\":\\\"testkey\\\",\\\"value\\\":\\\"testvalue\\\",\\\"property\\\":\\\"\\\"}]}],\\\"Imock\\\":[{\\\"dsName\\\":\\\"erpc_merger_inner\\\",\\\"data\\\":[{\\\"key\\\":\\\"key1\\\",\\\"value\\\":\\\"value1\\\",\\\"property\\\":\\\"\\\"},{\\\"key\\\":\\\"key3\\\",\\\"value\\\":\\\"value3\\\",\\\"property\\\":\\\"\\\"}]}]}],\\\"caseRunStage\\\":[{\\\"group_name\\\":\\\"ERPC校验(第一组)\\\",\\\"data\\\":[{\\\"input\\\":\\\"{\\\\n \\\\\\\"param_manager\\\\\\\": {\\\\n \\\\\\\"expand_param\\\\\\\": {\\\\n \\\\\\\"key_value_list\\\\\\\": [\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature1\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"true\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature2\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"3,8;4,16\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature3\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"1\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature4\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"one_phase_model_searching,200,166,1\\\\\\\"\\\\n },\\\\n {\\\\n \\\\\\\"key\\\\\\\": \\\\\\\"feature5\\\\\\\",\\\\n \\\\\\\"value\\\\\\\": \\\\\\\"false\\\\\\\"\\\\n }\\\\n ]\\\\n }\\\\n }\\\\n}\\\",\\\"expect\\\":\\\"{\\\\n \\\\\\\"result\\\\\\\": \\\\\\\"1\\\\\\\"\\\\n}\\\"}]}]}','直播',0,'c++',0);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 178, - "Type": 2, - "Content": "+", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 179, - "Type": 2, - "Content": "+INSERT INTO `got_envs` (`gmt_create`,`gmt_modified`,`scenario_id`,`name`,`status`,`host_ip`,`env_detail`) VALUES ('2020-04-28 19:12:55','2020-04-28 19:12:55',1,'初始测试环境','SUCCESS','11.167.254.210','123');", - "Comments": null, - "SectionInfo": null - } - ] - } - ], - "IsIncomplete": false - }, - { - "Name": "src/main/resources/static/index.html", - "OldName": "src/main/resources/static/index.html", - "Index": 6, - "Addition": 1, - "Deletion": 1, - "Type": 2, - "IsCreated": false, - "IsDeleted": false, - "IsBin": false, - "IsLFSFile": false, - "IsRenamed": false, - "IsSubmodule": false, - "Sections": [ - { - "Name": "", - "Lines": [ - { - "LeftIdx": 0, - "RightIdx": 0, - "Type": 4, - "Content": "@@ -24,7 +24,7 @@", - "Comments": null, - "SectionInfo": { - "Path": "src/main/resources/static/index.html", - "LastLeftIdx": 0, - "LastRightIdx": 0, - "LeftIdx": 24, - "RightIdx": 24, - "LeftHunkSize": 7, - "RightHunkSize": 7 - } - }, - { - "LeftIdx": 24, - "RightIdx": 24, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 25, - "RightIdx": 25, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 26, - "RightIdx": 26, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 27, - "RightIdx": 0, - "Type": 3, - "Content": "- ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 0, - "RightIdx": 27, - "Type": 2, - "Content": "+ ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 28, - "RightIdx": 28, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 29, - "RightIdx": 29, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 30, - "RightIdx": 30, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - } - ] - }, - { - "Name": "", - "Lines": [ - { - "LeftIdx": 0, - "RightIdx": 0, - "Type": 4, - "Content": " ", - "Comments": null, - "SectionInfo": { - "Path": "src/main/resources/static/index.html", - "LastLeftIdx": 30, - "LastRightIdx": 30, - "LeftIdx": 43, - "RightIdx": 43, - "LeftHunkSize": 0, - "RightHunkSize": 0 - } - } - ] - } - ], - "IsIncomplete": false - }, - { - "Name": "src/test/java/com/alibaba/markovdemo/MarkovDemoApplicationTests.java", - "OldName": "src/test/java/com/alibaba/markovdemo/MarkovDemoApplicationTests.java", - "Index": 7, - "Addition": 0, - "Deletion": 27, - "Type": 2, - "IsCreated": false, - "IsDeleted": false, - "IsBin": false, - "IsLFSFile": false, - "IsRenamed": false, - "IsSubmodule": false, - "Sections": [ - { - "Name": "", - "Lines": [ - { - "LeftIdx": 0, - "RightIdx": 0, - "Type": 4, - "Content": "@@ -32,36 +32,9 @@ class MarkovDemoApplicationTests {", - "Comments": null, - "SectionInfo": { - "Path": "src/test/java/com/alibaba/markovdemo/MarkovDemoApplicationTests.java", - "LastLeftIdx": 0, - "LastRightIdx": 0, - "LeftIdx": 32, - "RightIdx": 32, - "LeftHunkSize": 36, - "RightHunkSize": 9 - } - }, - { - "LeftIdx": 32, - "RightIdx": 32, - "Type": 1, - "Content": " \t\treturn df2.format(date1);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 33, - "RightIdx": 33, - "Type": 1, - "Content": " \t}", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 34, - "RightIdx": 34, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 35, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 36, - "RightIdx": 35, - "Type": 1, - "Content": " \t@Test", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 37, - "RightIdx": 36, - "Type": 1, - "Content": " \tvoid wordTest () throws IOException {", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 38, - "RightIdx": 37, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 39, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\t// FileInputStream fis = new FileInputStream(\"199801.txt\");", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 40, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\t// FileOutputStream fos = new FileOutputStream(\"dic.txt\");", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 41, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\t// ImportCorpus readF = new ImportCorpus(fis, fos);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 42, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\t// readF.readDic();", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 43, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\t// System.out.println(\"µ¼Èë½áÊø\");", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 44, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 45, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tString filename = \"dic.txt\";", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 46, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tHashMap hm = new HashMap();", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 47, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tHashMap len = new HashMap();", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 48, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tGenerateDictionary genDic = new GenerateDictionary();", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 49, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tSegmentation seg;", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 50, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 51, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tgenDic.genHashDic(filename, hm, len);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 52, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 53, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tInputStreamReader reader = new InputStreamReader(System.in);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 54, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tBufferedReader br = new BufferedReader(reader);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 55, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tString data = \"\";", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 56, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tdata = br.readLine();", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 57, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 58, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tseg = new Segmentation(hm, len);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 59, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 60, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tString FmmTarget = seg.Fmm(data);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 61, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tString BmmTarget = seg.Bmm(data);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 62, - "RightIdx": 0, - "Type": 3, - "Content": "-", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 63, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tSystem.out.println(\"FmmTarget: \" + FmmTarget);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 64, - "RightIdx": 0, - "Type": 3, - "Content": "-\t\tSystem.out.println(\"BmmTarget: \" + BmmTarget);", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 65, - "RightIdx": 38, - "Type": 1, - "Content": " \t}", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 66, - "RightIdx": 39, - "Type": 1, - "Content": " ", - "Comments": null, - "SectionInfo": null - }, - { - "LeftIdx": 67, - "RightIdx": 40, - "Type": 1, - "Content": " }", - "Comments": null, - "SectionInfo": null - } - ] - } - ], - "IsIncomplete": false } - ] } ``` --- @@ -4951,3 +2351,132 @@ http://localhost:3000/api//api/repositories/3868/delete_file | jq } ``` --- + + + +### DevOps相关api +--- + +#### 初始化DevOps流程 +``` +POST /api/dev_ops/cloud_accounts +``` + +*示例* +``` +curl -X POST http://localhost:3000/api/dev_ops/cloud_accounts | jq +``` + +*返回参数说明:* + +|参数名|类型|说明| +|-|-|-| +|status |string|服务端返回状态,0: 表示请求成功, -1: 标识请求失败| +|message |string|服务端返回信息说明| +|redirect_url |string|重定向地址,请求成功后,需要调整到该地址进行认证| + +返回值 +``` +{ + "status": 0, + "message": "success", + "redirect_url": "http://192.168.2.59:3003/login/oauth/authorize?client_id=f0c58484-d0f7-46c0-9efd-de3e3218e723&redirect_uri=http://121.36.81.172:80/login&response_type=code" +} +``` +--- + +#### 获取语言列表 +``` +GET /api/dev_ops/languages +``` + +*示例* +``` +curl -X GET http://localhost:3000/api/dev_ops/languages.json | jq +``` + +*返回参数说明:* + +|参数名|类型|说明| +|-|-|-| +|id |int|id值| +|name |string|语言名称| +|content |string|语言内容| +|cover_url |string|语言的logo链接| + +返回值 +``` +[ + { + "id": 114, + "name": "C", + "cover_url": null, + "content": "kind: pipeline\n name: default\n\n platform:\n os: linux\n arch: arm64\n\n steps:\n - name: test\n image: gcc\n commands:\n - ./configure\n - make\n - make test", + } +] +``` +--- + +#### 获取常用的6大语言 +``` +GET /api/dev_ops/languages/common +``` + +*示例* +``` +curl -X GET http://localhost:3000/api/dev_ops/languages/common.json | jq +``` + +*返回参数说明:* + +|参数名|类型|说明| +|-|-|-| +|id |int|id值| +|name |string|语言名称| +|content |string|语言内容| +|cover_url |string|语言的logo链接| + +返回值 +``` +[ + { + "id": 114, + "name": "C", + "cover_url": null, + "content": "kind: pipeline\n name: default\n\n platform:\n os: linux\n arch: arm64\n\n steps:\n - name: test\n image: gcc\n commands:\n - ./configure\n - make\n - make test", + } +] +``` +--- + +#### 获取语言详情 +``` +GET /api/dev_ops/languages/:id +``` + +*示例* +``` +curl -X GET http://localhost:3000/api/dev_ops/languages/114.json | jq +``` + +*返回参数说明:* + +|参数名|类型|说明| +|-|-|-| +|id |int|id值| +|name |string|语言名称| +|content |string|语言内容| +|cover_url |string|语言的logo链接| + +返回值 +``` +[ + { + "id": 114, + "name": "C", + "cover_url": null, + "content": "kind: pipeline\n name: default\n\n platform:\n os: linux\n arch: arm64\n\n steps:\n - name: test\n image: gcc\n commands:\n - ./configure\n - make\n - make test", + } +] +``` +--- diff --git a/app/controllers/dev_ops/cloud_accounts_controller.rb b/app/controllers/dev_ops/cloud_accounts_controller.rb index 0cc63ced8..0eb4270ce 100644 --- a/app/controllers/dev_ops/cloud_accounts_controller.rb +++ b/app/controllers/dev_ops/cloud_accounts_controller.rb @@ -7,16 +7,16 @@ class DevOps::CloudAccountsController < ApplicationController DevOps::CreateCloudAccountForm.new(devops_params).validate! logger.info "######### devops_params: #{devops_params}" logger.info "######### ......: #{(IPAddr.new devops_params[:ip_num]).to_i}" - logger.info "######### ......: #{DevopsCloudAccount.encrypted_secret(devops_params[:secret])}" + logger.info "######### ......: #{DevOps::CloudAccount.encrypted_secret(devops_params[:secret])}" # 1. 保存华为云服务器帐号 - logger.info "######### ......ff: #{devops_params.merge(ip_num: IPAddr.new(devops_params[:ip_num]).to_i, secret: DevopsCloudAccount.encrypted_secret(devops_params[:secret]))}" - create_params = devops_params.merge(ip_num: IPAddr.new(devops_params[:ip_num]).to_i, secret: DevopsCloudAccount.encrypted_secret(devops_params[:secret])) + logger.info "######### ......ff: #{devops_params.merge(ip_num: IPAddr.new(devops_params[:ip_num]).to_i, secret: DevOps::CloudAccount.encrypted_secret(devops_params[:secret]))}" + create_params = devops_params.merge(ip_num: IPAddr.new(devops_params[:ip_num]).to_i, secret: DevOps::CloudAccount.encrypted_secret(devops_params[:secret])) logger.info "######### create_params: #{create_params}" - cloud_account = DevopsCloudAccount.new(create_params) + cloud_account = DevOps::CloudAccount.new(create_params) cloud_account.user = current_user cloud_account.save # 2. 生成oauth2应用程序的client_id和client_secrete - gitea_oauth = Gitea::Oauth2::CreateService.call(current_user.gitea_token, {name: "pipeline", redirect_uris: [cloud_account.drone_url]}) + gitea_oauth = Gitea::Oauth2::CreateService.call(current_user.gitea_token, {name: "pipeline", redirect_uris: ["#{cloud_account.drone_url}/login"]}) logger.info "######### gitea_oauth: #{gitea_oauth}" oauth = Oauth.new(client_id: gitea_oauth['client_id'], client_secret: gitea_oauth['client_secret'], @@ -42,6 +42,7 @@ class DevOps::CloudAccountsController < ApplicationController redirect_url = "#{Gitea.gitea_config[:domain]}/login/oauth/authorize?client_id=#{oauth.client_id}&redirect_uri=#{cloud_account.drone_url}/login&response_type=code" + logger.info "######### redirect_url: #{redirect_url}" if result render_ok(redirect_url: redirect_url) else diff --git a/app/controllers/dev_ops/languages_controller.rb b/app/controllers/dev_ops/languages_controller.rb new file mode 100644 index 000000000..5863be647 --- /dev/null +++ b/app/controllers/dev_ops/languages_controller.rb @@ -0,0 +1,20 @@ +class DevOps::LanguagesController < ApplicationController + before_action :require_login + before_action :find_langugae, only: :show + + def index + @languages = DevOps::Language.by_usage_amount_desc + end + + def show + end + + def common + @languages = DevOps::Language.six_common + end + + private + def find_langugae + @language = DevOps::Language.find params[:id] + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2dc8c897d..1ac9a85b7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -436,4 +436,9 @@ module ApplicationHelper def find_user_by_login(login) User.find_by_login login end + + def render_base64_decoded(str) + return nil if str.blank? + Base64.decode64 str + end end diff --git a/app/helpers/dev_ops/languages_helper.rb b/app/helpers/dev_ops/languages_helper.rb new file mode 100644 index 000000000..00b1b6183 --- /dev/null +++ b/app/helpers/dev_ops/languages_helper.rb @@ -0,0 +1,2 @@ +module DevOps::LanguagesHelper +end diff --git a/app/libs/dev_ops/drone/ci.rb b/app/libs/dev_ops/drone/ci.rb index 62bdd69ac..13eed9ba5 100644 --- a/app/libs/dev_ops/drone/ci.rb +++ b/app/libs/dev_ops/drone/ci.rb @@ -1,23 +1,25 @@ class DevOps::Drone::Ci - attr_reader :host, :username, :password + attr_reader :host, :username, :password, :gitea_username # host: drone server's ip # username: drone server's account # password: drone server's password # eq: # DevOps::Drone::Ci.new(@cloud_account.drone_ip, @cloud_account.account, @cloud_account.visible_secret).get_token - def initialize(host, username, password) - @host = host - @username = username - @password = password + def initialize(host, username, password, gitea_username) + @host = host + @username = username + @password = password + @gitea_username = gitea_username end def get_token + puts "--------- sshpass -p #{password} ssh -o 'StrictHostKeyChecking no' #{username}@#{host} '#{cmd}'" `sshpass -p #{password} ssh -o "StrictHostKeyChecking no" #{username}@#{host} "#{cmd}"` end private def cmd - "cd ..; cd var/lib/drone/; sqlite3 database.sqlite; .dump; select user_hash from users where user_login=#{username} " + "cd ..; cd var/lib/drone/; sqlite3 database.sqlite; .dump; select user_hash from users where user_login=#{gitea_username} " end end diff --git a/app/libs/dev_ops/drone/client.rb b/app/libs/dev_ops/drone/client.rb index 8e479b09c..540876bc6 100644 --- a/app/libs/dev_ops/drone/client.rb +++ b/app/libs/dev_ops/drone/client.rb @@ -33,7 +33,6 @@ class DevOps::Drone::Client --restart always \ --name drone-agent--#{client_id} \ --net='bridge' \ - drone/drone-runner-docker:1 - " + drone/drone-runner-docker:1" end end diff --git a/app/libs/dev_ops/drone/request.rb b/app/libs/dev_ops/drone/request.rb new file mode 100644 index 000000000..ddead22b5 --- /dev/null +++ b/app/libs/dev_ops/drone/request.rb @@ -0,0 +1,110 @@ + # @private + class DevOps::Drone::Request + format :json + headers 'Accept' => 'application/json' + parser Proc.new { |body, _| parse(body) } + + attr_accessor :private_token + + # Converts the response body to an ObjectifiedHash. + def self.parse(body) + body = decode(body) + + if body.is_a? Hash + ObjectifiedHash.new body + elsif body.is_a? Array + body.collect! { |e| ObjectifiedHash.new(e) } + elsif body == true + body + else + raise Error::Parsing.new "Couldn't parse a response body" + end + end + + # Decodes a JSON response into Ruby object. + def self.decode(response) + begin + JSON.load response + rescue JSON::ParserError + raise Error::Parsing.new "The response is not a valid JSON" + end + end + + def get(path, options={}) + set_httparty_config(options) + set_private_token_header(options) + validate self.class.get(path, options) + end + + def post(path, options={}) + set_httparty_config(options) + set_private_token_header(options, path) + validate self.class.post(path, options) + end + + def put(path, options={}) + set_httparty_config(options) + set_private_token_header(options) + validate self.class.put(path, options) + end + + def delete(path, options={}) + set_httparty_config(options) + set_private_token_header(options) + validate self.class.delete(path, options) + end + + # Checks the response code for common errors. + # Returns parsed response for successful requests. + def validate(response) + # case response.code + # when 400; raise Error::BadRequest.new error_message(response) + # when 401; raise Error::Unauthorized.new error_message(response) + # when 403; raise Error::Forbidden.new error_message(response) + # when 404; raise Error::NotFound.new error_message(response) + # when 405; raise Error::MethodNotAllowed.new error_message(response) + # when 406; raise Error::DataNotAccepted.new error_message(response) + # when 409; raise Error::Conflict.new error_message(response) + # when 500; raise Error::InternalServerError.new error_message(response) + # when 502; raise Error::BadGateway.new error_message(response) + # when 503; raise Error::ServiceUnavailable.new error_message(response) + # end + + response.parsed_response + end + + # Sets a base_uri and default_params for requests. + # @raise [Error::MissingCredentials] if endpoint not set. + def set_request_defaults(endpoint, private_token, sudo=nil) + raise Error::MissingCredentials.new("Please set an endpoint to API") unless endpoint + @private_token = private_token + + self.class.base_uri endpoint + self.class.default_params :sudo => sudo + self.class.default_params.delete(:sudo) if sudo.nil? + end + + private + + # Sets a PRIVATE-TOKEN header for requests. + # @raise [Error::MissingCredentials] if private_token not set. + def set_private_token_header(options, path=nil) + unless path == '/session' + raise Error::MissingCredentials.new("Please set a private_token for user") unless @private_token + options[:headers] = {'PRIVATE-TOKEN' => @private_token} + end + end + + # Set HTTParty configuration + # @see https://github.com/jnunemaker/httparty + def set_httparty_config(options) + if self.httparty + options.merge!(self.httparty) + end + end + + def error_message(response) + "Server responded with code #{response.code}, message: #{response.parsed_response.message}. " \ + "Request URI: #{response.request.base_uri}#{response.request.path}" + end + end diff --git a/app/libs/dev_ops/drone/server.rb b/app/libs/dev_ops/drone/server.rb index 22e864c69..04c7a9cda 100644 --- a/app/libs/dev_ops/drone/server.rb +++ b/app/libs/dev_ops/drone/server.rb @@ -33,9 +33,12 @@ class DevOps::Drone::Server ` end + # TODO 一下代码方便测试,正式环境请移除 + # docker rm -f `docker ps -qa` def generate_cmd - "service docker start; docker run \ + "service docker start; docker rm -f `docker ps -qa`; docker run \ -v /var/run/docker.sock:/var/run/docker.sock \ + -v /var/lib/drone:/data \ -e DRONE_GITEA_SERVER=#{gitea_url} \ -e DRONE_GITEA_CLIENT_ID=#{client_id} \ -e DRONE_GITEA_CLIENT_SECRET=#{client_secret} \ @@ -48,8 +51,7 @@ class DevOps::Drone::Server --detach=true \ --name=drone-server-#{client_id} \ --net='bridge' \ - drone/drone:1 - " + drone/drone:1" end private diff --git a/app/models/dev_ops.rb b/app/models/dev_ops.rb new file mode 100644 index 000000000..f6b80f15f --- /dev/null +++ b/app/models/dev_ops.rb @@ -0,0 +1,5 @@ +module DevOps + def self.table_name_prefix + 'dev_ops_' + end +end diff --git a/app/models/devops_cloud_account.rb b/app/models/dev_ops/cloud_account.rb similarity index 88% rename from app/models/devops_cloud_account.rb rename to app/models/dev_ops/cloud_account.rb index a77e3ff8a..255396493 100644 --- a/app/models/devops_cloud_account.rb +++ b/app/models/dev_ops/cloud_account.rb @@ -1,8 +1,7 @@ -class DevopsCloudAccount < ApplicationRecord +class DevOps::CloudAccount < ApplicationRecord belongs_to :project belongs_to :user - def drone_host [drone_ip, ":80"].join end @@ -22,4 +21,5 @@ class DevopsCloudAccount < ApplicationRecord def self.encrypted_secret(str) Base64.encode64(str.strip).gsub(/\n/, '') end + end diff --git a/app/models/dev_ops/language.rb b/app/models/dev_ops/language.rb new file mode 100644 index 000000000..742ae54ea --- /dev/null +++ b/app/models/dev_ops/language.rb @@ -0,0 +1,15 @@ +class DevOps::Language < ApplicationRecord + # before_save :encode_content + + belongs_to :cover, class_name: "Attachment", foreign_key: :cover_id, optional: true + + scope :six_common, -> { limit(6).by_usage_amount_desc } + scope :without_content, -> { select(column_names - ['content']) } + scope :by_usage_amount_desc, -> { order(usage_amount: :desc) } + + + private + def encode_content + self.content = Base64.encode64 content + end +end diff --git a/app/views/dev_ops/languages/common.json.jbuilder b/app/views/dev_ops/languages/common.json.jbuilder new file mode 100644 index 000000000..ba0214c89 --- /dev/null +++ b/app/views/dev_ops/languages/common.json.jbuilder @@ -0,0 +1,6 @@ +json.array! @languages do |lang| + json.id lang.id + json.name lang.name + json.content render_base64_decoded lang.content + json.cover_url lang.cover_id.present? ? download_url(lang.cover) : nil +end diff --git a/app/views/dev_ops/languages/index.json.jbuilder b/app/views/dev_ops/languages/index.json.jbuilder new file mode 100644 index 000000000..ba0214c89 --- /dev/null +++ b/app/views/dev_ops/languages/index.json.jbuilder @@ -0,0 +1,6 @@ +json.array! @languages do |lang| + json.id lang.id + json.name lang.name + json.content render_base64_decoded lang.content + json.cover_url lang.cover_id.present? ? download_url(lang.cover) : nil +end diff --git a/app/views/dev_ops/languages/show.json.jbuilder b/app/views/dev_ops/languages/show.json.jbuilder new file mode 100644 index 000000000..2fbef2baa --- /dev/null +++ b/app/views/dev_ops/languages/show.json.jbuilder @@ -0,0 +1,4 @@ +json.id @language.id +json.name @language.name +json.content render_base64_decoded @language.content +json.cover_url @language.cover_id.present? ? download_url(@language.cover) : nil diff --git a/config/routes.rb b/config/routes.rb index 25626273e..af6c4cf7f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,11 @@ Rails.application.routes.draw do scope '/api' do namespace :dev_ops do resources :cloud_accounts, only: [:create] + resources :languages, only: [:index, :create, :show] do + collection do + get :common + end + end end resources :composes do diff --git a/db/migrate/20200710124116_create_dev_ops_languages.rb b/db/migrate/20200710124116_create_dev_ops_languages.rb new file mode 100644 index 000000000..1a899ad0d --- /dev/null +++ b/db/migrate/20200710124116_create_dev_ops_languages.rb @@ -0,0 +1,11 @@ +class CreateDevOpsLanguages < ActiveRecord::Migration[5.2] + def change + create_table :dev_ops_languages do |t| + t.string :name, null: false, comment: 'The name of project language.' + t.text :content, null: false, comment: 'The content of project language.' + t.integer :usage_amount, default: 0, comment: 'number of people Using the language' + + t.timestamps + end + end +end diff --git a/db/migrate/20200713150706_create_dev_ops_cloud_accounts.rb b/db/migrate/20200713150706_create_dev_ops_cloud_accounts.rb new file mode 100644 index 000000000..3351ab399 --- /dev/null +++ b/db/migrate/20200713150706_create_dev_ops_cloud_accounts.rb @@ -0,0 +1,14 @@ +class CreateDevOpsCloudAccounts < ActiveRecord::Migration[5.2] + def change + create_table :dev_ops_cloud_accounts do |t| + t.integer :project_id, null: false + t.integer :user_id, null: false + t.integer :ip_num + t.string :account + t.string :secret + + t.timestamps + end + add_index :dev_ops_cloud_accounts, [:project_id, :user_id, :ip_num], name: 'dev_ops_cloud_accounts_p_u_ip' + end +end diff --git a/db/migrate/20200714014513_add_cover_id_to_dev_ops_languages.rb b/db/migrate/20200714014513_add_cover_id_to_dev_ops_languages.rb new file mode 100644 index 000000000..6e88bfa2a --- /dev/null +++ b/db/migrate/20200714014513_add_cover_id_to_dev_ops_languages.rb @@ -0,0 +1,5 @@ +class AddCoverIdToDevOpsLanguages < ActiveRecord::Migration[5.2] + def change + add_column :dev_ops_languages, :cover_id, :integer + end +end diff --git a/db/migrate/20200714032759_drop_devops_clound_accounts_table.rb b/db/migrate/20200714032759_drop_devops_clound_accounts_table.rb new file mode 100644 index 000000000..d0bfb6f83 --- /dev/null +++ b/db/migrate/20200714032759_drop_devops_clound_accounts_table.rb @@ -0,0 +1,5 @@ +class DropDevopsCloundAccountsTable < ActiveRecord::Migration[5.2] + def change + drop_table(:devops_cloud_accounts) if ActiveRecord::Base.connection.tables.include?('devops_cloud_accounts') + end +end diff --git a/lib/tasks/dev_ops_languages.rake b/lib/tasks/dev_ops_languages.rake new file mode 100644 index 000000000..59b99413a --- /dev/null +++ b/lib/tasks/dev_ops_languages.rake @@ -0,0 +1,715 @@ +desc "Initialize the data for dev ops languages" +namespace :dev_ops_languages do + + task init: :environment do + # DevOps::Language.bulk_insert do |worker| + # languages.each do |attrs| + # worker.add(attrs) + # end + # end + + languages.each do |l| + content = Base64.encode64 l[:content] + DevOps::Language.create!(name: l[:name], content: content) + end + end + + def languages + [ + { + name: "C", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: gcc + commands: + - ./configure + - make + - make test" + }, + { + name: "C++", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: gcc + commands: + - ./configure + - make + - make test" + }, + { + name: "Docker", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: docker:dind + volumes: + - name: dockersock + path: /var/run/docker.sock + commands: + - docker ps -a + + volumes: + - name: dockersock + host: + path: /var/run/docker.sock" + }, + { + name: "Java", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: maven:3-jdk-10 + commands: + - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V + - mvn test -B" + }, + { + name: "R", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: r-base + commands: + - R -e 'install.packages(c('package1','package2'))' + - R CMD build ." + }, + { + name: "Ruby", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: ruby + commands: + - bundle install --jobs=3 --retry=3 + - rake" + }, + { + name: "PHP", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: install + image: composer + commands: + - composer install + + - name: test + image: php:7 + commands: + - vendor/bin/phpunit --configuration config.xml" + }, + { + name: "Python", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: python + commands: + - pip install -r requirements.txt + - pytest" + }, + { + name: "MySQL", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: mysql + commands: + - sleep 15 + - mysql -u root -h database --execute='SELECT VERSION();' + + services: + - name: database + image: mysql + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + MYSQL_DATABASE: test" + }, + { + name: "MongoDB", + content: 'kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: ping + image: mongo:4 + commands: + - sleep 5 + - mongo --host mongo --eval "db.version()" + + services: + - name: mongo + image: mongo:4 + command: [ --smallfiles ]' + }, + { + name: "Clojure", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: clojure + commands: + - lein test" + }, + { + name: "CouchDB", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: couchdb:2.2 + commands: + - sleep 15 + - curl http://database:5984 + + services: + - name: database + image: couchdb:2.2" + }, + { + name: "Crystal", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: crystallang/crystal + commands: + - shards install + - crystal spec.2" + }, + { + name: "D", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: dlanguage/dmd + commands: + - dub test" + }, + { + name: "Dart", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: google/dart + commands: + - pub get + - pub run test" + }, + { + name: "Docker (dind)", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: docker:dind + volumes: + - name: dockersock + path: /var/run + commands: + - sleep 5 # give docker enough time to start + - docker ps -a + + services: + - name: docker + image: docker:dind + privileged: true + volumes: + - name: dockersock + path: /var/run + + volumes: + - name: dockersock + temp: {}" + }, + { + name: "Elasticsearch", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: alpine:3.8 + commands: + - apk add curl + - sleep 45 + - curl http://database:9200 + + services: + - name: database + image: elasticsearch:5-alpine" + }, + { + name: "Elixir", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: elixir:1.5 + commands: + - mix local.rebar --force + - mix local.hex --force + - mix deps.get + - mix test" + }, + { + name: "Erlang", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: erlang:21 + commands: + - rebar get-deps + - rebar compile + - rebar skip_deps=true eunit" + }, + { + name: "20.Go (with Gopath)", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + workspace: + base: /go + path: src/hello-world + + steps: + - name: test + image: golang + commands: + - go get + - go test" + }, + { + name: "21.Go (with Modules)", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: golang + commands: + - go test + - go build" + }, + { + name: "Gradle", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: gradle:jdk10 + commands: + - gradle assemble + - gradle check" + }, + { + name: "Groovy", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: gradle:2.5-jdk8 + commands: + - ./gradlew assemble + - ./gradlew check" + }, + { + name: "Haskell", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: haskell + commands: + - cabal install --only-dependencies --enable-tests + - cabal configure --enable-tests + - cabal build + - cabal test" + }, + { + name: "Haxe", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: haxe + commands: + - haxelib install build.hxml + - haxe build.hxml" + }, + { + name: "MariaDB", + content: 'kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: mariadb + commands: + - sleep 15 + - mysql -u root -h database --execute="SELECT VERSION();" + + services: + - name: database + image: mariadb + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: "yes" + MYSQL_DATABASE: test' + }, + { + name: "Maven", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: maven:3-jdk-10 + commands: + - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V + - mvn test -B" + }, + { + name: "Memcached", + content: 'kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: ubuntu + commands: + - apt-get update -qq + - apt-get install -y -qq telnet > /dev/null + - (sleep 1; echo "stats"; sleep 2; echo "quit";) | telnet cache 11211 || true + + services: + - name: cache + image: memcached:alpine + command: [ -vv ]' + }, + { + name: "Nats", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: ruby:2 + commands: + - gem install nats + - nats-pub -s tcp://nats:4222 greeting 'hello' + - nats-pub -s tcp://nats:4222 greeting 'world' + + services: + - name: nats + image: nats:1.3.0" + }, + { + name: "Node", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: node + commands: + - npm install + - npm test" + }, + { + name: "Perl", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: perl + commands: + - cpanm --quiet --installdeps --notest . + - perl Build.PL + - ./Build test" + }, + { + name: "Postgres", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: postgres:9-alpine + commands: + - psql -U postgres -d test -h database + + services: + - name: database + image: postgres:9-alpine + environment: + POSTGRES_USER: postgres + POSTGRES_DB: test" + }, + { + name: "Redis", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: redis + commands: + - sleep 5 + - redis-cli -h redis ping + - redis-cli -h redis set FOO bar + - redis-cli -h redis get FOO + + services: + - name: redis + image: redis" + }, + { + name: "RethinkDB", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: node:9 + commands: + - npm install -s -g recli + - recli -h database -j" + 'r.db("rethinkdb").table("stats")' + + + "services: + - name: database + image: rethinkdb:2 + command: [ rethinkdb, --bind, all ]" + }, + { + name: "Rust", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: rust:1.30 + commands: + - cargo build --verbose --all + - cargo test --verbose --all" + }, + { + name: "Swift", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: swift:4 + commands: + - swift build + - swift test" + }, + { + name: "Vault", + content: "kind: pipeline + name: default + + platform: + os: linux + arch: arm64 + + steps: + - name: test + image: vault:1.0.0-beta2 + environment: + VAULT_ADDR: http://vault:8200 + VAULT_TOKEN: dummy + commands: + - sleep 5 + - vault kv put secret/my-secret my-value=s3cr3t + - vault kv get secret/my-secret + + services: + - name: vault + image: vault:1.0.0-beta2 + environment: + VAULT_DEV_ROOT_TOKEN_ID: dummy" + } + ] + end +end