From 882abf6bbba794c7aa5cbbeca89b313a9927f47e Mon Sep 17 00:00:00 2001 From: i-robot Date: Sat, 13 Nov 2021 10:13:37 +0000 Subject: [PATCH 01/13] update test8.txt. --- test8.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test8.txt b/test8.txt index 53dba01..1e2df68 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 -- Gitee From 0a43faba24f94d33e3003bcb7309c1f4c1d1755d Mon Sep 17 00:00:00 2001 From: i-robot Date: Sat, 13 Nov 2021 10:14:07 +0000 Subject: [PATCH 02/13] update test7.txt. --- test7.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test7.txt b/test7.txt index fe77e59..8466a8a 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 -- Gitee From b927116ad2ce4b345a877cf23619ef4f0826587b Mon Sep 17 00:00:00 2001 From: i-robot Date: Sat, 13 Nov 2021 10:21:47 +0000 Subject: [PATCH 03/13] update test6.txt. --- test6.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test6.txt b/test6.txt index 53dba01..6e0cb4e 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 -- Gitee From b103c0faf47643a388d319c168b342f311db4858 Mon Sep 17 00:00:00 2001 From: i-robot Date: Sat, 13 Nov 2021 10:25:11 +0000 Subject: [PATCH 04/13] update test2.txt. --- test2.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test2.txt b/test2.txt index 9665fec..0ece73c 100644 --- a/test2.txt +++ b/test2.txt @@ -1 +1,2 @@ 5555 +6666 \ No newline at end of file -- Gitee From 054dedd55137f992bdebcf274f79f6f10454fd59 Mon Sep 17 00:00:00 2001 From: i-robot Date: Sat, 13 Nov 2021 10:30:04 +0000 Subject: [PATCH 05/13] update test2.txt. --- test2.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test2.txt b/test2.txt index 0ece73c..63678c3 100644 --- a/test2.txt +++ b/test2.txt @@ -1,2 +1,4 @@ 5555 -6666 \ No newline at end of file +6666 + +888 \ No newline at end of file -- Gitee From 273ae6b6e400e49c2f93c13641deca1ebe177f47 Mon Sep 17 00:00:00 2001 From: i-robot Date: Sat, 13 Nov 2021 10:33:11 +0000 Subject: [PATCH 06/13] update test2.txt. --- test2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test2.txt b/test2.txt index 63678c3..23006e4 100644 --- a/test2.txt +++ b/test2.txt @@ -1,4 +1,4 @@ 5555 6666 - +777 888 \ No newline at end of file -- Gitee From 32234639da31ee65983612d0ba5882d07f382b3d Mon Sep 17 00:00:00 2001 From: i-robot Date: Sat, 13 Nov 2021 15:41:36 +0000 Subject: [PATCH 07/13] update test2.txt. --- test2.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test2.txt b/test2.txt index 23006e4..27892aa 100644 --- a/test2.txt +++ b/test2.txt @@ -1,4 +1,5 @@ 5555 6666 777 -888 \ No newline at end of file +888 +999 \ No newline at end of file -- Gitee From b7372ecc6d67639092dd44c2e4eb59843a363b6c Mon Sep 17 00:00:00 2001 From: i-robot Date: Sat, 13 Nov 2021 16:09:49 +0000 Subject: [PATCH 08/13] update test2.txt. --- test2.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test2.txt b/test2.txt index 27892aa..78aaedd 100644 --- a/test2.txt +++ b/test2.txt @@ -2,4 +2,5 @@ 6666 777 888 -999 \ No newline at end of file +999 +000 \ No newline at end of file -- Gitee From 260be3966739ec4e2513d9f87fac3087d6647af3 Mon Sep 17 00:00:00 2001 From: i-robot Date: Mon, 15 Nov 2021 09:56:11 +0000 Subject: [PATCH 09/13] add compare.md. --- compare.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 compare.md diff --git a/compare.md b/compare.md new file mode 100644 index 0000000..3aa58e1 --- /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 | 无 | +| | | | | | + -- Gitee From 97e115744c8d338f3268b282d83493728bc3ff60 Mon Sep 17 00:00:00 2001 From: i-robot Date: Thu, 18 Nov 2021 01:48:54 +0000 Subject: [PATCH 10/13] add repohandle.yaml. --- repohandle.yaml | 137 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 repohandle.yaml diff --git a/repohandle.yaml b/repohandle.yaml new file mode 100644 index 0000000..de70052 --- /dev/null +++ b/repohandle.yaml @@ -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 +``` + -- Gitee From 9d8a574c94a5370bc115dedd3d8b0d3d4bb0f390 Mon Sep 17 00:00:00 2001 From: i-robot Date: Thu, 18 Nov 2021 01:49:20 +0000 Subject: [PATCH 11/13] rename repohandle.yaml to repohandle.md. --- repohandle.yaml => repohandle.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename repohandle.yaml => repohandle.md (100%) diff --git a/repohandle.yaml b/repohandle.md similarity index 100% rename from repohandle.yaml rename to repohandle.md -- Gitee From 4d0b483594f72151d7b0c23ce5177031730f23cd Mon Sep 17 00:00:00 2001 From: i-robot Date: Wed, 2 Aug 2023 06:26:11 +0000 Subject: [PATCH 12/13] add pdfid.sh. Signed-off-by: i-robot --- pdfid.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 pdfid.sh diff --git a/pdfid.sh b/pdfid.sh new file mode 100644 index 0000000..21cd13f --- /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 \ No newline at end of file -- Gitee From 1edc6bbc5fb38693b73bbd87111757e3db8696f7 Mon Sep 17 00:00:00 2001 From: zengchen1024 Date: Wed, 2 Aug 2023 14:38:01 +0800 Subject: [PATCH 13/13] update --- pdfid.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pdfid.sh b/pdfid.sh index 21cd13f..177abdf 100644 --- a/pdfid.sh +++ b/pdfid.sh @@ -1,15 +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 \ No newline at end of file +#!/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 -- Gitee