forked from infra/otc-metadata
few fixes
This commit is contained in:
parent
d83fb45ecc
commit
1219bfdc99
@ -53,6 +53,31 @@ def process_services(args, services):
|
||||
default_merge_style="squash",
|
||||
branch_protections=[]
|
||||
)
|
||||
github_bp = dict(
|
||||
branch_name="main",
|
||||
enable_approvals_whitelist=True,
|
||||
approvals_whitelist_teams=["docs-infra-team"],
|
||||
block_on_rejected_reviews=True,
|
||||
dismiss_stale_approvals=True,
|
||||
enable_push=False,
|
||||
status_check_contexts=["gl/check"],
|
||||
enable_merge_whitelist=True,
|
||||
merge_whitelist_usernames=["zuul"]
|
||||
)
|
||||
github_repo_template = dict(
|
||||
default_branch="main",
|
||||
description="Open Telekom Cloud Service docs",
|
||||
homepage=None,
|
||||
archived=False,
|
||||
has_issues=True,
|
||||
has_projects=False,
|
||||
has_wiki=False,
|
||||
delete_branch_on_merge=True,
|
||||
allow_merge_commit=False,
|
||||
allow_squash_merge=True,
|
||||
allow_rebase_merge=False,
|
||||
branch_protections=[]
|
||||
)
|
||||
|
||||
for service in services:
|
||||
logging.debug(f"Processing service {service}")
|
||||
@ -87,8 +112,29 @@ def process_services(args, services):
|
||||
config = {repo_name: data}
|
||||
|
||||
elif repo["type"] == 'github':
|
||||
data = None
|
||||
# TODO
|
||||
teams = []
|
||||
branch_protections_main = copy.deepcopy(github_bp)
|
||||
if "teams" in repo:
|
||||
teams_def = repo["teams"]
|
||||
if "teams" in service:
|
||||
teams_def = service["teams"]
|
||||
if teams_def:
|
||||
for team in teams_def:
|
||||
teams.append({
|
||||
"slug": team["name"],
|
||||
"permission": "push" if team["permission"] == "write" else "pull"
|
||||
})
|
||||
data = copy.deepcopy(github_repo_template)
|
||||
data["description"] = (
|
||||
f"Open Telekom Cloud {service['service_title']} "
|
||||
f"Service docs"
|
||||
)
|
||||
data["branch_protections"].append({"branch": "main",
|
||||
"template": "zuul"})
|
||||
data["teams"] = teams
|
||||
repo_name = repo["repo"].split('/')[1]
|
||||
config = {repo_name: data}
|
||||
|
||||
else:
|
||||
logging.error(
|
||||
"Repository type %s is not supported",
|
||||
|
@ -94,7 +94,7 @@ def process_repositories(args, service):
|
||||
|
||||
for doc in data.docs_by_service_type(service["service_type"]):
|
||||
logging.debug(f"Analyzing document {doc}")
|
||||
if args.document_type and doc["type"] != args.document_type:
|
||||
if args.document_type and doc.get("type") != args.document_type:
|
||||
logging.info(
|
||||
f"Skipping synchronizing {doc['title']} "
|
||||
f"due to the doc-type filter.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user