From 6da7b5e6ad7da0a04011cd00fe37ae5589e4b12e Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 23 Mar 2018 13:17:35 -0700 Subject: [PATCH] Alias zuul git repos to git.zuul-ci.org This adds support for the cgit-alias directive added in https://review.openstack.org/555105. It's safe to land this change before or after the implementation. It also aliases the zuul project repos to git.zuul-ci.org. Change-Id: I05a7156e092faad1457973b88537ec73012a5c96 --- gerrit/projects.yaml | 18 ++++++++++++++++++ tools/check_valid_gerrit_projects.py | 27 ++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/gerrit/projects.yaml b/gerrit/projects.yaml index c5d6bba72f..1bd056673b 100755 --- a/gerrit/projects.yaml +++ b/gerrit/projects.yaml @@ -249,6 +249,9 @@ - openstack-ci - project: openstack-infra/nodepool use-storyboard: true + cgit-alias: + site: git.zuul-ci.org + path: nodepool groups: - openstack-ci description: Manage a pool of nodes for a distributed test infrastructure @@ -837,16 +840,25 @@ acl-config: /home/gerrit2/acls/openstack-infra/zuul.config - project: openstack-infra/zuul use-storyboard: true + cgit-alias: + site: git.zuul-ci.org + path: zuul groups: - openstack-ci description: The Gatekeeper, or a project gating system - project: openstack-infra/zuul-base-jobs use-storyboard: true + cgit-alias: + site: git.zuul-ci.org + path: zuul-base-jobs groups: - openstack-ci description: Zuul base job definition - project: openstack-infra/zuul-jobs use-storyboard: true + cgit-alias: + site: git.zuul-ci.org + path: zuul-jobs groups: - openstack-ci description: Ansible job definitions for Zuul @@ -857,11 +869,17 @@ description: Zuul packaging - project: openstack-infra/zuul-sphinx use-storyboard: true + cgit-alias: + site: git.zuul-ci.org + path: zuul-sphinx groups: - openstack-ci description: Sphinx extension for Zuul jobs - project: openstack-infra/zuul-website use-storyboard: true + cgit-alias: + site: git.zuul-ci.org + path: zuul-website groups: - openstack-ci description: The contents of the Zuul website diff --git a/tools/check_valid_gerrit_projects.py b/tools/check_valid_gerrit_projects.py index 071ce16c9f..bb96dd25e7 100755 --- a/tools/check_valid_gerrit_projects.py +++ b/tools/check_valid_gerrit_projects.py @@ -108,11 +108,13 @@ def main(): VALID_LABELS = ["acl-config", "description", "docimpact-group", "groups", "homepage", "options", "project", - "upstream", "upstream-prefix", "use-storyboard"] + "upstream", "upstream-prefix", "use-storyboard", + "cgit-alias"] VALID_SCHEMES = ['https://', 'http://', 'git://'] DESCRIPTION_REQUIRED = ['openstack', 'openstack-infra', 'openstack-dev', 'stackforge'] VALID_OPTIONS = ['delay-release', 'track-upstream', 'translate'] + CGIT_ALIAS_SITES = ['zuul-ci.org'] for p in projects: name = p.get('project') @@ -189,6 +191,29 @@ def main(): found_errors += 1 print("ERROR: Unknown keyword '%s' in project %s" % (entry, name)) + # Check for valid cgit aliases + cgit_alias = p.get('cgit_alias') + if cgit_alias: + if not isinstance(cgit_alias, dict): + found_errors += 1 + print("ERROR: cgit alias in project %s must be a dict" % + (name,)) + else: + if 'site' not in cgit_alias or 'path' not in cgit_alias: + found_errors += 1 + print("ERROR: cgit alias in project %s must have " + "a site and path" % (name,)) + else: + site = cgit_alias['site'] + path = cgit_alias['path'] + if path.startswith('/'): + found_errors += 1 + print("ERROR: cgit alias path in project %s must " + "not begin with /" % (name,)) + if site not in CGIT_ALIAS_SITES: + found_errors += 1 + print("ERROR: cgit alias site in project %s is " + "not valid" % (name,)) # Check for valid options for option in p.get('options', []): if option not in VALID_OPTIONS: