Fixing the validate-legacy script
validate-legacy script supposed to verify if repository is retired properly or not basically keep only two file .gitreview and README.rst[1]. Currently this script only checks the partially retired project and not if project team itself is retired which end up having a incorrect retirement. Example, recently retired project senlin: Even the repo content removal was not correct - https://review.opendev.org/c/openstack/solum/+/920201 the below governance change still passed and this script did not complain - https://review.opendev.org/c/openstack/governance/+/919347/ Fixing it so that it cover both case partial as well as complete retirement. [1] https://docs.openstack.org/project-team-guide/repository.html#step-2-remove-project-content Ref: https://etherpad.opendev.org/p/tc-retirement-cleanup Change-Id: I1d5048ec38fa1af625a32e0f0885e9a3c3f46d0e
This commit is contained in:
parent
2d41d77fa3
commit
aa230b6bbd
@ -21,7 +21,24 @@ import requests
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
FILES_URL = "https://opendev.org/api/v1/repos/{}/git/trees/master"
|
FILES_URL = "https://opendev.org/api/v1/repos/{}/git/trees/master"
|
||||||
IGNORED_REPOS = []
|
IGNORED_REPOS = [
|
||||||
|
# NOTE(gmann): The below list represent the prefix of the old uncleaned
|
||||||
|
# retired repositories. They are too many and not worth to cleanup now.
|
||||||
|
# For more details, ref to https://etherpad.opendev.org/p/tc-retirement-cleanup
|
||||||
|
'openstack/app-catalog',
|
||||||
|
'openstack/congress-dashboard',
|
||||||
|
'openstack/cue',
|
||||||
|
'openstack/deb',
|
||||||
|
'openstack/magnetodb',
|
||||||
|
'openstack/openstack-chef-repo',
|
||||||
|
'openstack/openstack-salt',
|
||||||
|
'openstack/ossa',
|
||||||
|
'openstack/python-appcatalogclient',
|
||||||
|
'openstack/python-cueclient',
|
||||||
|
'openstack/python-magnetodbclient',
|
||||||
|
'openstack/refstack',
|
||||||
|
'openstack/salt',
|
||||||
|
'openstack/security-doc']
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -36,8 +53,20 @@ with open(args.legacy_projects, 'r', encoding='utf-8') as f:
|
|||||||
|
|
||||||
errors = 0
|
errors = 0
|
||||||
for team_name, team_data in legacy_projects.items():
|
for team_name, team_data in legacy_projects.items():
|
||||||
# Check if the team has been retired
|
# Check if the team has been retired or partially retired
|
||||||
if 'retired-on' in team_data:
|
retired = True
|
||||||
|
partially_retired = False
|
||||||
|
if 'partial' in team_data:
|
||||||
|
partially_retired = True
|
||||||
|
if 'retired-on' not in team_data:
|
||||||
|
retired = False
|
||||||
|
# Check if team is not retired or partially retired but has entry in the
|
||||||
|
# legacy project file.
|
||||||
|
if not retired and not partially_retired:
|
||||||
|
print('{} team has no retired-on date or missing partial retirement flag'.format(
|
||||||
|
team_name
|
||||||
|
))
|
||||||
|
errors += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
deliverables = team_data.get('deliverables')
|
deliverables = team_data.get('deliverables')
|
||||||
@ -51,20 +80,26 @@ for team_name, team_data in legacy_projects.items():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# In this case, team is not retired but has retired projects
|
# In this case, team is not retired but has retired projects
|
||||||
for deliverable_name, deliverable_data in deliverables.items():
|
if partially_retired:
|
||||||
# Retired-on date missing for a deliverable
|
for deliverable_name, deliverable_data in deliverables.items():
|
||||||
if 'retired-on' not in deliverable_data:
|
# Retired-on date missing for a deliverable
|
||||||
print('{} is missing a retired-on date'.format(deliverable_name))
|
if 'retired-on' not in deliverable_data:
|
||||||
errors += 1
|
print('{} is missing a retired-on date'.format(deliverable_name))
|
||||||
continue
|
errors += 1
|
||||||
|
|
||||||
# Ensure that the repositories has no content.
|
|
||||||
for repo in deliverable_data['repos']:
|
|
||||||
if repo in IGNORED_REPOS:
|
|
||||||
msg = '{} is ignored'.format(repo)
|
|
||||||
print(msg)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
for deliverable_name, deliverable_data in deliverables.items():
|
||||||
|
# Ensure that the repositories have no content.
|
||||||
|
for repo in deliverable_data['repos']:
|
||||||
|
repo_ignored = False
|
||||||
|
for ir in IGNORED_REPOS:
|
||||||
|
if repo.startswith(ir):
|
||||||
|
msg = '{} is an old repository and not worth do the cleanup, ignoring.'.format(repo)
|
||||||
|
print(msg)
|
||||||
|
repo_ignored = True
|
||||||
|
break
|
||||||
|
if repo_ignored:
|
||||||
|
continue
|
||||||
if repo.startswith('opendev/'):
|
if repo.startswith('opendev/'):
|
||||||
msg = '{} not in openstack namespace, ignoring.'.format(repo)
|
msg = '{} not in openstack namespace, ignoring.'.format(repo)
|
||||||
print(msg)
|
print(msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user