Merge "teach list-deliverables to filter on governance tags"
This commit is contained in:
commit
2aacb993bf
@ -63,6 +63,12 @@ def main():
|
||||
'--type',
|
||||
help='deliverable type, such as "library" or "service"',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--tag',
|
||||
default=[],
|
||||
action='append',
|
||||
help='look for one more more tags on the deliverable or team',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--deliverables-dir',
|
||||
default=openstack_releases.deliverable_dir,
|
||||
@ -144,6 +150,11 @@ def main():
|
||||
continue
|
||||
if args.missing_rc and deliv.latest_release and 'rc' in deliv.latest_release:
|
||||
continue
|
||||
if args.tag:
|
||||
tags = deliv.tags
|
||||
for t in args.tag:
|
||||
if t not in tags:
|
||||
continue
|
||||
if args.verbose:
|
||||
print(verbose_template.format(
|
||||
name=deliv.name,
|
||||
|
@ -22,6 +22,8 @@ import os
|
||||
import pbr.version
|
||||
import yaml
|
||||
|
||||
from openstack_releases import governance
|
||||
|
||||
|
||||
def _safe_semver(v):
|
||||
"""Get a SemanticVersion that closely represents the version string.
|
||||
@ -196,6 +198,8 @@ class Deliverables(object):
|
||||
|
||||
class Deliverable(object):
|
||||
|
||||
_governance_data = None
|
||||
|
||||
def __init__(self, team, series, name, data):
|
||||
self.team = team
|
||||
if self.team is None:
|
||||
@ -207,6 +211,8 @@ class Deliverable(object):
|
||||
for r in self.releases:
|
||||
for p in r['projects']:
|
||||
self.repos.add(p['repo'])
|
||||
if self._governance_data is None:
|
||||
Deliverable._governance_data = governance.get_team_data()
|
||||
|
||||
@property
|
||||
def model(self):
|
||||
@ -248,3 +254,8 @@ class Deliverable(object):
|
||||
if b['name'] == name:
|
||||
return b['location']
|
||||
return None
|
||||
|
||||
@property
|
||||
def tags(self):
|
||||
return governance.get_tags_for_deliverable(
|
||||
self._governance_data, self.team, self.name)
|
||||
|
@ -35,6 +35,15 @@ def get_team_data(url=PROJECTS_LIST):
|
||||
return yaml.load(r.text)
|
||||
|
||||
|
||||
def get_tags_for_deliverable(team_data, team, name):
|
||||
"Return the tags for the deliverable owned by the team."
|
||||
team_info = team_data[team]
|
||||
dinfo = team_info['deliverables'].get(name)
|
||||
if not dinfo:
|
||||
return set()
|
||||
return set(dinfo.get('tags', [])).union(set(team_info.get('tags', [])))
|
||||
|
||||
|
||||
def get_repo_owner(team_data, repo_name):
|
||||
"""Return the name of the team that owns the repository.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user