def validate_repos_and_admins(jjb): jjb_repos = jjb.get_repos() app_int_repos = queries.get_repos() missing_repos = [r for r in jjb_repos if r not in app_int_repos] if missing_repos: msg = 'repos are missing from codeComponents: ' + missing_repos raise Exception(msg) jjb_admins = jjb.get_admins() app_int_users = queries.get_users() app_int_bots = queries.get_bots() github_usernames = \ [u.get('github_username') for u in app_int_users] + \ [b.get('github_username') for b in app_int_bots] unknown_admins = [a for a in jjb_admins if a not in github_usernames] if unknown_admins: logging.warning('user file not found for: {}'.format(unknown_admins))
def validate_repos_and_admins(jjb): jjb_repos = jjb.get_repos() app_int_repos = queries.get_repos() missing_repos = [r for r in jjb_repos if r not in app_int_repos] for r in missing_repos: logging.error('repo is missing from codeComponents: {}'.format(r)) jjb_admins = jjb.get_admins() app_int_users = queries.get_users() app_int_bots = queries.get_bots() github_usernames = \ [u.get('github_username') for u in app_int_users] + \ [b.get('github_username') for b in app_int_bots] unknown_admins = [a for a in jjb_admins if a not in github_usernames] for a in unknown_admins: logging.warning('admin is missing from users: {}'.format(a)) if missing_repos: sys.exit(1)
def validate_repos_and_admins(jjb, additional_repo_urls): jjb_repos = jjb.get_repos() jjb_repos.update(additional_repo_urls) app_int_repos = queries.get_repos() missing_repos = [r for r in jjb_repos if r not in app_int_repos] for r in missing_repos: logging.error(f"repo is missing from codeComponents: {r}") jjb_admins = jjb.get_admins() app_int_users = queries.get_users() app_int_bots = queries.get_bots() external_users = queries.get_external_users() github_usernames = ([u.get("github_username") for u in app_int_users] + [b.get("github_username") for b in app_int_bots] + [u.get("github_username") for u in external_users]) unknown_admins = [a for a in jjb_admins if a not in github_usernames] for a in unknown_admins: logging.warning("admin is missing from users: {}".format(a)) if missing_repos: sys.exit(1)