add teams info into metadata

This commit is contained in:
Artem Goncharov 2022-09-06 15:41:01 +02:00
parent d30e3d778f
commit 4c7e210159
3 changed files with 169 additions and 28 deletions

File diff suppressed because it is too large Load Diff

View File

@ -9,20 +9,9 @@ new_data = data._service_data
services = data.service_dict
for srv in new_data["services"]:
if len(srv["repositories"]) ==1:
r1 = srv["repositories"][0]
srv["repositories"] = [
{
"environment": r1["environment"],
"repo": r1["repo"],
"type": r1["type"]
},
{
"environment": "public",
"repo": 'opentelekomcloud-' + r1["repo"],
"type": "github"
},
]
srv["teams"] = [
{"name": f"docs-{srv['service_category']}-rw", "permission": "write"}
]
_yaml = YAML()

View File

@ -23,8 +23,8 @@ import otc_metadata.services
data = otc_metadata.services.Services()
def process_repositories(args, services):
"""Checkout repositories
def process_services(args, services):
"""Process services
"""
gitea_bp = dict(
@ -68,7 +68,11 @@ def process_repositories(args, services):
teams = [{"name": "docs-infra-team", "permission": "write"}]
branch_protections_main = copy.deepcopy(gitea_bp)
if "teams" in repo:
for team in repo["teams"]:
teams_def = repo["teams"]
if "teams" in service:
teams_def = service["teams"]
if teams_def:
for team in teams_def:
branch_protections_main["approvals_whitelist_teams"].append(
team["name"])
teams.append(dict(
@ -113,11 +117,6 @@ def main():
required=True,
help='Environment to be used as a source'
)
# parser.add_argument(
# '--gitcontrol-repo',
# required=True,
# help='Gitcontrol repository url'
# )
parser.add_argument(
'--work-dir',
required=True,
@ -127,7 +126,7 @@ def main():
args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG)
process_repositories(args, data.all_services)
process_services(args, data.all_services)
if __name__ == '__main__':