From c16025342ab82beb043f0abd20ab53f195f7246b Mon Sep 17 00:00:00 2001 From: openEulerCompetition Date: Wed, 16 Dec 2020 00:53:25 +0800 Subject: [PATCH 1/2] update TEAM_INFO/teaminfo.yaml. --- TEAM_INFO/teaminfo.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TEAM_INFO/teaminfo.yaml b/TEAM_INFO/teaminfo.yaml index 6e919cd..9009816 100644 --- a/TEAM_INFO/teaminfo.yaml +++ b/TEAM_INFO/teaminfo.yaml @@ -3,8 +3,8 @@ version: 1.0 giteeurl: https://gitee.com/openeuler2020 teams: - teamid: 123324214343 - teamname: OSCHINA - description: "This is a template repository." + teamname: "OSCHINA" + description: "赛题77,团队编号:0000,团队名称:OSCHINA." repository: template repotype: private tutor: -- Gitee From 4679e390436e8c2ba34ff170725d414a8c8ba8d4 Mon Sep 17 00:00:00 2001 From: georgecao Date: Wed, 16 Dec 2020 10:21:22 +0800 Subject: [PATCH 2/2] updata ci-check file. --- TEAM_INFO/teaminfo.yaml | 4 ++-- script/ci_valid_check.py | 50 +++++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/TEAM_INFO/teaminfo.yaml b/TEAM_INFO/teaminfo.yaml index 9009816..138e12a 100644 --- a/TEAM_INFO/teaminfo.yaml +++ b/TEAM_INFO/teaminfo.yaml @@ -4,7 +4,7 @@ giteeurl: https://gitee.com/openeuler2020 teams: - teamid: 123324214343 teamname: "OSCHINA" - description: "赛题77,团队编号:0000,团队名称:OSCHINA." + description: "TOPIC_ID:77, TEAM_ID:0000, TEAM_NAME:OSCHINA." repository: template repotype: private tutor: @@ -14,4 +14,4 @@ teams: - giteeid: littlegirl email: lisi2@huawei.com - giteeid: george - email: wangwu123@qq.com \ No newline at end of file + email: wangwu123@qq.com diff --git a/script/ci_valid_check.py b/script/ci_valid_check.py index 0867703..df47afa 100644 --- a/script/ci_valid_check.py +++ b/script/ci_valid_check.py @@ -8,6 +8,7 @@ import yaml import os import sys import requests +import json TEAMINFO = "TEAM_INFO/teaminfo.yaml" LEGALIDS = "TEAM_INFO/legalids.yaml" @@ -54,6 +55,7 @@ def repo_member_valid_check(user, token): :param token: :return: ''' + print(">>>>>>>>Begin user valid check.") issue_found = 0 ''' check user gitee id valid @@ -62,25 +64,34 @@ def repo_member_valid_check(user, token): param = {'access_token': token} response = requests.get(user_url, params=param) if response.status_code != 200: - print( - "Get User {} information from gitee failed.".format( - user['giteeid'])) + print("Get User {} information from gitee failed.".format(user['giteeid'])) issue_found += 1 return ''' check user cla sign. ''' - cla_url = CLA_API param = {'email': user['email']} - response = requests.get(user_url, params=param) + response = requests.get(CLA_API, params=param) if response.status_code != 200: - print("Get User{} cla info failed.".format(user['giteeid'])) + print("Get User:{} cla info failed.".format(user['giteeid'])) + issue_found += 1 + return issue_found + + jstr = json.loads(response.text) + if 'data' not in jstr.keys(): issue_found += 1 + print("Json decode failed.") return issue_found -# if not response.data.signed: -# print("User{} has not signed CLA.".format(user['giteeid'])) -# issue_found += 1 + data = jstr['data'] + if 'signed' not in data.keys(): + issue_found += 1 + print("Json decode signed field failed.") + return issue_found + if not data['signed']: + print("User{} has not signed CLA.".format(user['giteeid'])) + issue_found += 1 + print(">>>>>>>>End user valid check, issue:{}.".format(issue_found)) return issue_found @@ -90,6 +101,7 @@ def member_check(team, token): :param tutorinfo: :return: ''' + print(">>>>>>begin member check.") issue_found = 0 membersinfo = team['members'] for member in membersinfo: @@ -98,7 +110,7 @@ def member_check(team, token): if 'email' not in member.keys(): continue issue_found += repo_member_valid_check(member, token) - + print(">>>>>>end member check, issue:{}.".format(issue_found)) return issue_found @@ -108,6 +120,7 @@ def tutor_check(team, token): :param tutorinfo: :return: ''' + print(">>>>>>begin tutor check.") issue_found = 0 tutorsinfo = team['tutor'] for tutor in tutorsinfo: @@ -116,7 +129,7 @@ def tutor_check(team, token): if 'email' not in tutor.keys(): continue issue_found += repo_member_valid_check(tutor, token) - + print(">>>>>>end tutor check, issue:{}.".format(issue_found)) return issue_found @@ -126,10 +139,12 @@ def teamid_valid_check(team, legalids): :param legalids: legal team ids :return: ''' + print(">>>>>>begin teamid check.") issue_found = 0 if team['teamid'] not in legalids: print("Team id:{} is not in legal team id list.", team['teamid']) issue_found += 1 + print(">>>>>>end teamid check, issue:{}.".format(issue_found)) return issue_found @@ -139,9 +154,11 @@ def teamid_reused_check(teamids): :param teamids: :return: ''' + print(">>>>Begin teamid reused check.") issue_found = 0 if len(teamids) != len(set(teamids)): issue_found += 1 + print(">>>>End teamid reused check, issue:{}.".format(issue_found)) return issue_found def orgrepo_reused_check(repos): @@ -150,9 +167,11 @@ def orgrepo_reused_check(repos): :param repos:repository name set :return: ''' + print(">>>>Begin repo reused check.") issue_found = 0 if len(repos) != len(set(repos)): issue_found += 1 + print(">>>>End repo reused check, issue:{}.".format(issue_found)) return issue_found @@ -163,6 +182,7 @@ def validaty_check_teaminfo(teams, token, legalids): :param legalids: legal team ids list. :return: pass check return 0, else return issue count. ''' + print(">>Begin teaminfo check.") issue_found = 0 team_ids = [] @@ -181,7 +201,7 @@ def validaty_check_teaminfo(teams, token, legalids): ''' issue_found += teamid_reused_check(team_ids) issue_found += orgrepo_reused_check(org_repos) - + print(">>End teaminfo check, issue:{}.".format(issue_found)) return issue_found @@ -190,10 +210,12 @@ def validaty_check_version(version): :param version: configure file version, current version 1.0 :return: version equal 1.0 return 0, else return 1 ''' + print(">>Begin version check.") issue_found = 0 if version != 1.0: print("Version {} is not OK.".format(version)) issue_found = 1 + print(">>End version check, issue:{}".format(issue_found)) return issue_found @@ -202,6 +224,7 @@ def validaty_check_community(community, token): :param community: configure file community, current value: openeuler2020 :return: community equal 'openeuler2020' return 0, else return 1 ''' + print(">>Begin community check.") issue_found = 0 if community != 'openeuler2020': print("Community info{} is not correct.".format(community)) @@ -213,7 +236,7 @@ def validaty_check_community(community, token): if response.status_code != 200: print("Get organization {} information failed.".format(community)) issue_found += 1 - + print(">>End community check, issue:{}.".format(issue_found)) return issue_found @@ -274,6 +297,7 @@ def main(): legal_ids['legal_team_ids']) if issue_total != 0: + print("CI FAILED, issue count:{}".format(issue_total)) sys.exit(issue_total) print("FINISH") -- Gitee