On Wed, Nov 11, 2020 at 02:24:49PM +0800, Bai Jing wrote:
On Tue, Nov 10, 2020 at 05:48:25PM +0800, Luan Shengde wrote:
Signed-off-by: Luan Shengde shdluan@163.com
doc/mail-robot.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 doc/mail-robot.md
diff --git a/doc/mail-robot.md b/doc/mail-robot.md new file mode 100644 index 0000000..f829199 --- /dev/null +++ b/doc/mail-robot.md @@ -0,0 +1,97 @@ +# SPDX-License-Identifier: MulanPSL-2.0+
+# email monitor robot
+## purpose
+apply account/uuid for user
- uuid: used for user to submit jobs
- account: used for user to check the test data
+## allowed email format:
+subject: apply account +mail content
- commit url:
- my oss commit: commit_url
- example:
- my oss commit: https://github.com/torvalds/aalinux/commit/7be74942f184fdfba34ddd19a0d995deb...
+attahcment
- ssh pub_key
- file name:
- id_rsa.pub
+## steps overview
+1. mail-robot
monitor_new_email
- the monitor will listen to the mailbox for new email files
handle_new_email:
read email file content
apply_account
invoke AssignAccount for new account
+2. assign-account
- init my_info
- my_email
- my_name
- send_account
- parse_commit_url_pub_key
invoke ParseApplyAccountEmail
parse_commit_url
extract_commit_url
check whether there is a standard commit url
base_url_in_upstream_repos
check whether the repo's url in upstream-repos
commit_url_availability
check whether the commit url valid
- gitee_commit
clone the repo and check the commit
- non_gitee_commit(url)
check the commit with curl
parse_pub_key
check whether there is a ssh pub_key in the email file
attachment:
first attachment
file_name:
id_ras.pub
rescue error
error type:
- no commit url
- commit url not in upstream-repos
- commit url not available
- no pub_key
build_error_email with raised error message
send fail email
- apply_my_account
my_uuid
generate uuid
apply_account
invoke ApplyJumperAccount to apply new account with my_info and pub_key
my_info:
- my_email
- my_name
- my_uuid
apply_jumper_account
required data: pub_key
complete my_info
my_info add:
- my_login_name
- my_commit_url
store my_info
invoke es to store the apply infos
- send_mail
build_uuid_email
send mail
+3. continue the monitor
continue to monitor the mailbox for new email file
cycle run step 1 and 2 if matched email files
+4. service log
use the following command to get the logs
docker logs -f --tail=100 fluentd |grep mail-robot
^^ need space
I will fix it
Thanks, Luan Shengde
Thanks, Baijing
-- 2.23.0