diff --git a/compare.md b/compare.md new file mode 100644 index 0000000000000000000000000000000000000000..3aa58e17a8aec1a7f0e986ecf3c098bfb73c5138 --- /dev/null +++ b/compare.md @@ -0,0 +1,26 @@ +## diff ci-bot for gauss & Euler + +- 比较方式: + + `by vscode command`: code -r -d gauss/ci-bot/source_code_file euler/ci-bot/source_code_file + +- 比较分支 + + gauss/openGauss branch vs openEuler/stable branch + +| 插件 | gauss | Euler | 源文件 | robot-gitee新版插件 | +| -------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------------------------------- | ------------------------------------------------------------ | +| assign | 评论常量 | 评论常量值有差异 | assign.go
unassign.go | 待review | +| approve | 评论常量值有差异
加approved标签的权限判断:permission.Permission == "admin" \|\|permission.Permission == "write" \|\| isOwner | 评论常量值有差异
加approved标签的权限判断:permission.Permission == "admin" \|\|permission.Permission == "write" \|\| isOwner \|\| r==1 | approve.go | 1.评论需统一
2.有指定特殊仓库的配置项可作为判断sig/目录下文件改变权限判断的开关 | +| lgtm | 评论常量值有差异
支持设定所有仓库的lgtm标签数量 | 评论常量值有差异
除了支持所有仓库的lgtm标签数量还支持对单仓进行设定 | lgtm.go | 1.评论需统一
2.配置项作用域可为单仓单独设置 | +| check-pr | 不提供check-pr指令 | 提供check-pr指令 | checkpr.go | 默认支持/check-pr指令;考虑是否设置开关配置项 | +| checkcla | 支持设置设否自动检查cla | 默认自动检查 | checkcla.go
clahandler.go
pullrequest.go | claserver支持单独部署以支持、/check-cla指令;暂时未处理 | +| close issue & PR | 评论常量值评论人不使用@符号: %S | 评论常量值评论使用@符号: @%S | close.go | lifecycle插件 评论需统一 | +| commit_check | commitcheck.go代码一致
检查commit 数量 | commitcheck.go代码一致
不检查commit 数量 | commitcheck.go
pullrequest.go | label插件 | +| label | 支持PR commit改变时清除配置需清除的标签
PR合入时支持根据配置项检查PR 需要的标签,PR不能存在的标签
PR创建时根据数据库缓存的信息自动打sig标签 | 不支持PR commit改变时清除配置需清除的标签
PR合入时不支持根据配置项检查PR 需要的标签,PR不能存在的标签
不支持自动打sig标签 | label.go
pullrequest.go | label插件不支持自动打sig标签 | +| 检查是否设置reviewer | 检查PR是否设置Reviewer,未设置加评论提示 | 无 | | 无 | +| 待确定的功能(需要与曹志沟通了解背景) | 通知模板:Since you have added a item to the src-openeuler.yaml file, we will automatically generate a default package in project openEuler:Factory on OBS cluster for you.If you need a more customized configuration, you can configure it according to the following instructions: | 应该未使用,通知模板是固定的,貌似是监控的src-openeuler.yaml | pullrequest.go | 无 | +| retest | 当PR发生update时间时,加/retest评论 | 无 | pullrequest.go | 无 | +| welcome | PR创建时会在welcome消息后追加sig组 信息和committer信息 | 无 | pullrequest.go | 无 | +| | | | | | + diff --git a/pdfid.sh b/pdfid.sh new file mode 100644 index 0000000000000000000000000000000000000000..177abdfc35ce82fa97e068674568159b4c93931a --- /dev/null +++ b/pdfid.sh @@ -0,0 +1,15 @@ +#!/usr/bin/bash + +old=$1 +newid=$2 + +all=$(ls -l ${old}* | awk '{print $NF}') + + +for i in ${all[@]} +do + echo "file = $i" + j="${newid}${i#"$old"}" + echo "new = $j" + mv $i $j +done diff --git a/repohandle.md b/repohandle.md new file mode 100644 index 0000000000000000000000000000000000000000..de70052e108da1f6040710f039635aa0edb53a19 --- /dev/null +++ b/repohandle.md @@ -0,0 +1,137 @@ +# ci-bot 监听社区sig组,仓库处理程序流程梳理 + +## 概述 + +监听程序,由 repohandler、sighandler、ownershandler组成:每一个handler都是一个定时任务,分别处理对应的业务逻辑。此外当接受到gitee的push event 的webhook会判断对应的handler 关注的文件列表信息是否发生改变,如发生改变更新数据库缓存的文件信息以便下一次任务时能及时更新文件内容发生改变的相应逻辑。 + +### repohandler + +观察ci-bot watchProjectFiles 配置项配置的文件路径,根据文件内容创建或更新社区仓库信息。 + +watchProjectFiles 配置列子: + +```yaml +watchProjectFiles: + - watchProjectFileOwner: opengauss + watchprojectFileRepo: tc + watchprojectFilePath: repos.yaml + watchProjectFileRef: master +``` + +处理时序图如下所示: + + + +![inithandle](https://planttext.com/api/plantuml/svg/XLHRRkCm3FptANY0jjZlHL4KHK-mDr0asXQgXrUYw_Zs9IMbjHC7_RF48JapfFMQIIMQlUiw7KDl1tXyWL45up3zXG49sdLl7UQkHGGqM4Ai4ELSZGkOC51NWhjI6ODfe3ogRQ7tDucIN8FAi2ZEbMyRm4U33XWAMNqYn0JpP1JXDlsxWrwrGy0pQgv1UWGN1wklEoKL1YoiAvdIuXfKBlCJMyF0mYK3-edMGhHULxwDsXrZfCN54pYjKbTwsj37GmcJIXbXLRxwANOC4JZPqdgOKDNG1VFq3wV8zGazN6kgivozPnmanicfqYgdeFoFZEV7xnmQSGC_4AeJyaX0LTJ2S7FQDi3_yETctZ9EgLoJJSMp3dCwr5ccMazmOj5wF99N8spmOGrZ-xv1e4_H2qsPtwszKeyN0EdIJ4mgwGdpx8vCKAPf-3LX9p_WSg1dBxkkVAtEwqSs3Fb8_GvmVySQBSOA9FzYHPEtvK3hX0-ZoZRdkNmiziC-Q1OHlPT5_rHknXkA-pzuo-0QoIiKscRZsT8bO_iGoSztPypP8KwmM1h1p4cHZQ5eCxpYUARwJ7JTAxz7_Enz0G00) + +plan text + +```tex +@startuml + +config -> handler: get config files +handler -> gitee: get all files content +gitee -> handler: send files sha +handler -> DB: set sha as waitesha in model and save or update +handler -> handler: cycle exec watch logic +handler -> DB: range get files model +handler -> DB: models.targetsha is empty set target sha and save +handler -> gitee: get file content by modles info +handler -> handler: parse yaml file as go entity +handler -> handler: range to entity.Repos item +handler -> DB: get coummity repo count by repo name +handler <- DB: get the repo count +handler -> gitee: create a repo whe db repo count eq 0 +handler -> DB: save the created repo to db +handler -> handler: exec handle branch +handler -> DB: get branches +handler -> handler: diff branch from db and entity +handler -> DB: delete branch by diff result +handler -> gitee: add repo branch by diff result +handler -> DB: save the new branch +handler -> handler: exec update repo settings +handler -> DB: get repo settings info +handler -> handler: diff repo infos from db and entity +handler -> gitee: update repo type,hasissue,haswiki,cancomment values +handler -> DB: save or update repo infos +handler -> DB: when range exit update config files shas +handler -> handler: sleep with duration and do next cycle + +@enduml +``` + +### sighandler + +观察ci-bot watchSigFiles配置项配置的文件内容信息,当文件的内容发生改变时更新数据库缓存的sigs、以及sig 下仓库信息 + +watchSigFiles 配置列子: + +```yaml +- watchSigFileOwner: opengauss + watchSigFileRepo: tc + watchSigFilePath: sigs.yaml + watchSigFileRef: master +``` + +sighandler 时序图 + +![sighandler](https://planttext.com/api/plantuml/img/XL91RiCm3Bld5JosmFQ178PYs4VSI8wzEbPXAots-yLUWAHPizq4cHH9oQUi9kauXAPn9bBWXDStp6KB4lZeDJjpEAu1dKJh-nOzAxBlONtWl0RqNfatxuMb77MD-tXlqIKsof24yKgbMXY340USltuDmMHfp_7TQESEHmoiJWWr8THt5wZ9bwrwiRWIU_aSgMUeuzejEeZC11KGcu2xLxUJj1BcaDNqZiUVecJApzoKh8clafy7zDR29Xb0vmMAwVbHlqpVstZYGMwyOHkYLMUoNvKIvp7yCU21-nzjkM-UT-wZbKAIoFKwKplwx9hcn96cR_aD) + +paln text + +```tex +@startuml + +handler -> handler: do initsha() +handler -> config: get sig files +handler -> gitee: get sig files content +handler -> DB: create or update sig files model by sig files conten sha +handler -> handler: do watch() method start tick task +handler -> DB: get files model,judge the file sha need to deal with +handler -> gitee: get file content by sha +handler -> handler: handle sigs +handler -> DB: get sig repos +handler -> handler: diff from db sig repos and file content sigs content +handler -> DB: remove sig repos and add sig repos by diff result +handler -> DB: remove sigs and add sigs by diff result +handler -> DB: update sigs files info by one task finish + +@enduml +``` + +### ownershandler + +观察ci-bot watchOwnerFiles配置项配置的文件内容信息,当文件的内容发生改变时更新码云对应仓库的owners以及数据库缓存的owners: + +watchOwnerFiles 例子: + +```yaml +watchOwnerFiles: + - watchOwnerFileOwner: opengauss + watchOwnerFileRepo: tc + watchOwnerFilePath: sigs/*/OWNERS + watchOwnerFileRef: master +``` + +时序图: + +![ownershandle](https://planttext.com/api/plantuml/svg/bP913i8W44NtFSLSm0jqOHhZBOmBMWPA0aCpK8st5oYBghNH7V3dlpy_eGjHS9oTRPfHaBJ8S3Z2-TI2nWZ2Mc2SV81lQZ0whBLwR845QImofATw7Jmfey7V2NdRbhbnH71YkYGp2OTNXwvFyz0_AaOPCc7SYLrsphcBK1CtM-IqF0_3p8mKzxQJHYbGx5qkjhWgkNJyeAmXsaJ4j20wVyCNR-fLm8nXjl5znxyCDKH8-Hiy3-wGcmv9fi_n1000) + +```tex +@startuml + +handler -> DB: get all repos +handler -> DB: get all sigs +handler -> handler: range sigs and range config owners +handler -> handler: get the map[signame]members by range finish +handler -> handler: range repos and handle owners +handler -> DB: get the repo current owners +handler -> handler: diff from sig repo owners and repo current owner +handler -> gitee: remove repo owners by diff result +handler -> DB: remove repo owners by diff result +handler -> gitee: add owners by diff result +handler -> DB: add repo owners by diff result + +@enduml +``` + diff --git a/test2.txt b/test2.txt index 9665feccbefd564916e3b322fa34d9689a73f1bc..78aaedd03f0486b17491fe39934aee1257cd2e78 100644 --- a/test2.txt +++ b/test2.txt @@ -1 +1,6 @@ 5555 +6666 +777 +888 +999 +000 \ No newline at end of file diff --git a/test6.txt b/test6.txt index 53dba01b542f4649e53a7cd7339d50749a42eea4..6e0cb4e60557da5d7a2ed8d4b0a0ffb3667d5137 100644 --- a/test6.txt +++ b/test6.txt @@ -34,3 +34,4 @@ Software architecture description 4. The most valuable open source project [GVP](https://gitee.com/gvp) 5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) 6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +aaa \ No newline at end of file diff --git a/test7.txt b/test7.txt index fe77e59bdc6a9be54e48ed632c4f731937ad4942..8466a8ae73e67ae47a12357b5611ef7d5769f330 100644 --- a/test7.txt +++ b/test7.txt @@ -34,4 +34,6 @@ Software architecture description 4. The most valuable open source project [GVP](https://gitee.com/gvp) 5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) 6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) -sfsdfsfs \ No newline at end of file +sfsdfsfs\ + +ghgghhg \ No newline at end of file diff --git a/test8.txt b/test8.txt index 53dba01b542f4649e53a7cd7339d50749a42eea4..1e2df689ba7fc74846da6ec19abfbb2104349dcb 100644 --- a/test8.txt +++ b/test8.txt @@ -34,3 +34,4 @@ Software architecture description 4. The most valuable open source project [GVP](https://gitee.com/gvp) 5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) 6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +fsdhhghdg \ No newline at end of file