From 346d3d2f062dce8fcc714d78d56aa948f5598e3b Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Mon, 12 Aug 2019 10:04:19 -0400 Subject: [PATCH] linters: enforce ATC membership after January 2020 In the past, we did not have any enforcement for extra ATCs in terms of foundation membership. This has resulted in entries being added which are not foundation members that cannot be ATCs. This patch adds a check to ignore our old records (until they expire out in January 2020) and enforce it on any newly added ATCs. Change-Id: Id1f6d5b0bffb41c952e140372a3594669359fbdb --- tools/validate_atcs.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/validate_atcs.py b/tools/validate_atcs.py index 94c98d844..92057d55c 100755 --- a/tools/validate_atcs.py +++ b/tools/validate_atcs.py @@ -12,6 +12,7 @@ # under the License. import argparse +from datetime import datetime import json import logging @@ -110,6 +111,8 @@ def main(): with open(args.projects, 'r', encoding='utf-8') as f: projects = yaml.safe_load(f.read()) + exit_code = 0 + for project_name, project_data in sorted(projects.items()): atcs = project_data.get('extra-atcs', []) for atc in atcs: @@ -120,9 +123,20 @@ def main(): project_name, atc, e)) else: if not member: - print(('ERROR: {}: Did not find {} associated ' - 'with a member for {}').format( - project_name, atc['email'], atc)) + # NOTE(mnaser): The ATC membership checks were not + # enforced for all ATCs expiring before + # January 2020. This should be removed + # after January 2020. + expires = datetime.strptime(atc['expires-in'], "%B %Y") + if expires <= datetime(2020, 1, 1): + msg = 'Skipping {} from validation'.format(atc) + else: + msg = 'Unable to find membership: {}'.format(atc) + exit_code = 1 + + print('{}: {}'.format(project_name, msg)) + + return exit_code if __name__ == '__main__':