diff --git "a/CESHI_ZHUANYONG/CI\345\217\212\344\273\243\347\240\201\351\227\250\347\246\201/CI-META\344\273\223\345\272\223\351\205\215\347\275\256\350\247\204\350\214\203.md" "b/CESHI_ZHUANYONG/CI\345\217\212\344\273\243\347\240\201\351\227\250\347\246\201/CI-META\344\273\223\345\272\223\351\205\215\347\275\256\350\247\204\350\214\203.md" new file mode 100644 index 0000000000000000000000000000000000000000..5c4fb08dd30f487628a4147f79a0ec27ac086a5f --- /dev/null +++ "b/CESHI_ZHUANYONG/CI\345\217\212\344\273\243\347\240\201\351\227\250\347\246\201/CI-META\344\273\223\345\272\223\351\205\215\347\275\256\350\247\204\350\214\203.md" @@ -0,0 +1,214 @@ + +# 简介 +[CI-META仓库](https://gitee.com/anolis/ci-meta)做为OpenAnolis社区PackageCI测试流程的配置中心,提供了全局配置和自定义配置,全局配置默认对Gitee上的OpenAnolis企业账户下的所有仓库生效,自定义配置允许开发者通过自定义形式接入社区测试流程,本文主要介绍CI-META仓库配置规范。 + +加点信息 +# 目录结构 +仓库由三个全局yaml配置和一个自定义目录组成,全局配置无需开发者参与,默认生效,自定义目录允许开发者根据自身需要自定义测试配置,如果开发者对某个仓库配置了自定义测试,则不在运行全局配置的测试。 +```json +├── products.yaml #定义产品规范和匹配分支 +├── toneconfs.yaml #定义公共测试用例 +├── globals.yaml #定义官方仓库全局配置 +├── repos #自定义目录 +│   ├── a #软件包索引目录 +│   ├── b +│   ├── c +│   │  ├── cmake #软件包名称 +│   │  │  ├── ci.yaml #官方仓库自定义配置 +│   │  │  ├── test.sh #官方仓库自定义脚本 +│   │  └── cxxxx +│   ├── d +│   └── .... +``` + +# 全局配置 + +## products.yaml +产品配置文件,用于创建任务和筛选子模块配置。 +```yaml +products: + Anolis23: #产品名称 + short_name: an23 #产品名缩写,用于创建测试任务 + branch: ['a23'] #匹配分支,分支中包含branch,则匹配成功 + Anolis8: + short_name: an8 + branch: ['a8'] + default: True #默认产品配置 + Anolis7: + short_name: an7 + branch: ['a7'] + Anolis8.4: + short_name: an8.4 + branch: ['a8.4'] + Anolis8.2: + short_name: an8.2 + branch: ['a8.2'] + Anolis7.9: + short_name: an7.9 + branch: ['a7.9'] + Anolis7.7: + short_name: an7.7 + branch: ['a7.7'] +``` + +## toneconfs.yaml +公共测试用例配置文件,可以在globals.yaml和ci.yaml中引用。 +```yaml +basic_test: + tone_workspace: packageci + tone_project: Anolis_Packages + tone_test_suite: anolis-ci-test + tone_test_conf: group=basic_test + tone_test_case: check_license,check_specfile,check_codestyle +rpm_test: + tone_workspace: packageci + tone_project: Anolis_Packages + tone_test_suite: anolis-ci-test + tone_test_conf: group=rpm_test + tone_test_case: pkg_smoke_test,check_abi_diff,check_pkg_dependency +custom_test: + tone_workspace: packageci + tone_project: Anolis_Packages + tone_test_suite: anolis-ci-test + tone_test_conf: group=custom_test + tone_test_case: custom_script +``` + +## globals.yaml +全局配置文件,指明组织仓库运行的测试任务和任务运行方式。 +```yaml +src-anolis-os: #仓库所属组织名称 + code_test: #任务名称 + tone_test: basic_test #任务配置,来自公共测试用例配置文件 + server_config: '{product}-anck-x86_64' #任务运行机器配置,product为产品配置 + abs_build: + type: abs #任务类型,默认为tone + integration_test: + depend: [abs_build] #依赖任务,如果依赖任务失败,则不允许本任务 + tone_test: rpm_test + server_config: #支持不同规格服务器 + x86_64: '{product}-anck-x86_64' + aarch64: '{product}-anck-aarch64' + parallel: #任务运行方式,由上到下串行执行 + - code_test, abs_build #同一层并行执行 + - integration_test +``` + +# 自定义配置 + +## ci.yaml +当全局配置不能满足某个仓库的测试需求时,可以通过配置repos中的ci.yaml来接入自定义配置,ci.yaml中分为仓库配置,测试配置,通知配置。 + +### 仓库配置 +```yaml +#pr,即提交pr就会触发测试,支持gitee平台和github平台 +repo: + git_url: https://gitee.com/anolis/ci-meta.git + trigger_mode: pr + +#pull,定时监测指定仓库分支的commit,如果变化则触发测试 +repo: + git_url: https://gitee.com/anolis/ci-meta.git + git_branch: master + trigger_mode: pull + trigger_time: * * * * * #crontab风格时间表达式 +``` + +### 测试配置 +```yaml +#示例1,引用全局配置 +test: + test_task_1: + tone_test: basic_test + server_config: {product}-anck-x86_64 + +#示例2,覆盖全局配置 +test: + test_task_2: + tone_test: basic_test + basic_test: + tone_test_case: check_license,check_specfile + server_config: {product}-anck-x86_64 + +#示例3,自定义测试配置 +test: + test_task_3: + tone_test: keentune + keentune: + tone_workspace: keentune + tone_project: keentune + tone_test_suite: keentune + tone_test_conf: default + server_config: {product}-anck-x86_64 + +#示例4,自定义脚本配置 +test: + test_task_4: + tone_test: script + entry: test.sh #测试脚本需要放到ci.yaml同级目录中 + server_config: {product}-anck-x86_64 + +#示例5,运行并行测试任务 +test: + test_task_5: + tone_test: basic_test + server_config: {product}-anck-x86_64 + test_task_6: + tone_test: basic_test + server_config: {product}-anck-aarch64 + parallel: + - test_task_5, test_task_6 + +#示例6,运行串行测试任务 +test: + test_task_7: + tone_test: basic_test + server_config: {product}-anck-x86_64 + test_task_8: + tone_test: basic_test + server_config: {product}-anck-aarch64 + parallel: + - test_task_7 + - test_task_8 + +#示例8,扩展T-One配置 +test: + test_task_8: + tone_test: basic_test + basic_test: + tone_test_case: check_license,check_specfile + server_config: {product}-anck-x86_64 + tone_extend: #详细参数请参考 T-One API + need_reboot: 1 + script_info: + - pos: before + script: sleep 10 +``` + +### 通知配置 +```yaml +notice: + notice_mode: any/on_success/on_fail #通知模式,支持任意/仅成功/仅失败 + callback: 'https://xxx.com' + email: ['x1@xx.com', 'x2@xx.com'] + dingding: ['token1', 'token2'] +``` +上述三个部分组成一份ci.yaml,以下是一个完整示例: +```yaml +repo: + git_url: https://gitee.com/anolis/keentune.git + git_branch: master + trigger_mode: pull + trigger_time: 23 * * * * +test: + keentune_test: + tone_test: keentune + keentune: + tone_workspace: packageci + tone_project: Anolis_Packages + tone_test_suite: keentune + tone_test_conf: default + server_config: {product}-anck-x86_64 +notice: + dingding: ['token1', 'token2'] +``` diff --git a/CESHI_ZHUANYONG/maintainers.yaml b/CESHI_ZHUANYONG/maintainers.yaml index 3db82e5ee946ce098f511781d54756aeb4344585..a0d3b35a692ffd2d761ccf2ea34df4759c092e19 100644 --- a/CESHI_ZHUANYONG/maintainers.yaml +++ b/CESHI_ZHUANYONG/maintainers.yaml @@ -18,5 +18,4 @@ maintainers: # 指定文档目录对应的用户组 paths: - /*: *DG - - ../CI及代码门禁: *DG - - ./测试平台T-One/*: *NG \ No newline at end of file + - ../CI及代码门禁: *NG \ No newline at end of file