add teams info into metadata
This commit is contained in:
parent
d30e3d778f
commit
4c7e210159
File diff suppressed because it is too large
Load Diff
@ -9,19 +9,8 @@ new_data = data._service_data
|
|||||||
services = data.service_dict
|
services = data.service_dict
|
||||||
|
|
||||||
for srv in new_data["services"]:
|
for srv in new_data["services"]:
|
||||||
if len(srv["repositories"]) ==1:
|
srv["teams"] = [
|
||||||
r1 = srv["repositories"][0]
|
{"name": f"docs-{srv['service_category']}-rw", "permission": "write"}
|
||||||
srv["repositories"] = [
|
|
||||||
{
|
|
||||||
"environment": r1["environment"],
|
|
||||||
"repo": r1["repo"],
|
|
||||||
"type": r1["type"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"environment": "public",
|
|
||||||
"repo": 'opentelekomcloud-' + r1["repo"],
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ import otc_metadata.services
|
|||||||
data = otc_metadata.services.Services()
|
data = otc_metadata.services.Services()
|
||||||
|
|
||||||
|
|
||||||
def process_repositories(args, services):
|
def process_services(args, services):
|
||||||
"""Checkout repositories
|
"""Process services
|
||||||
|
|
||||||
"""
|
"""
|
||||||
gitea_bp = dict(
|
gitea_bp = dict(
|
||||||
@ -68,7 +68,11 @@ def process_repositories(args, services):
|
|||||||
teams = [{"name": "docs-infra-team", "permission": "write"}]
|
teams = [{"name": "docs-infra-team", "permission": "write"}]
|
||||||
branch_protections_main = copy.deepcopy(gitea_bp)
|
branch_protections_main = copy.deepcopy(gitea_bp)
|
||||||
if "teams" in repo:
|
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(
|
branch_protections_main["approvals_whitelist_teams"].append(
|
||||||
team["name"])
|
team["name"])
|
||||||
teams.append(dict(
|
teams.append(dict(
|
||||||
@ -113,11 +117,6 @@ def main():
|
|||||||
required=True,
|
required=True,
|
||||||
help='Environment to be used as a source'
|
help='Environment to be used as a source'
|
||||||
)
|
)
|
||||||
# parser.add_argument(
|
|
||||||
# '--gitcontrol-repo',
|
|
||||||
# required=True,
|
|
||||||
# help='Gitcontrol repository url'
|
|
||||||
# )
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--work-dir',
|
'--work-dir',
|
||||||
required=True,
|
required=True,
|
||||||
@ -127,7 +126,7 @@ def main():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
process_repositories(args, data.all_services)
|
process_services(args, data.all_services)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user