def get_all(project_id, project_url): issues = [] details = gitlab.get_issues(project_id) if validate.api_result(details): warning("[*] Found %s issues for project %s", len(details), project_url) for item in details: issues.append(types.Issue(item['iid'], item['web_url'], item['description'])) return issues
def get_all(project_id, project_url): merge_requests = [] details = gitlab.get_merge_requests(project_id) if validate.api_result(details): info("[*] Found %s merge requests for project %s", len(details), project_url) for item in details: merge_requests.append(types.Issue(item['iid'], item['web_url'], item['title'])) return merge_requests
def all_member_projects(member): personal_projects = {} details = gitlab.get_personal_projects(member) if validate.api_result(details): info("[*] Found %s projects for member %s", len(details), member) for item in details: personal_projects[item['id']] = item['http_url_to_repo'] return personal_projects
def get_all_project_members(project): members = {} info("[*] Fetching all members for project %s", project) details = gitlab.get_project_members(project) if validate.api_result(details): warning("[*] Found %s members for project %s", len(details), project) for item in details: members.update({item['username']: item['web_url']}) return members
def get_all(group): members = {} info("[*] Fetching all members for group %s", group) details = gitlab.get_members(group) if validate.api_result(details): info("[*] Found %s members for group %s", len(details), group) for item in details: members.update({item['username']: item['web_url']}) return members
def get_all(projects): snippets = {} for project in projects: for key, value in project.items(): details = gitlab.get_project_snippets(key) if validate.api_result(details): info("[*] Found %s snippets for project %s", len(details), value) for item in details: snippets.update({item['id']: item['web_url']}) return snippets
def all_group_projects(group): group_projects = {} info("[*] Fetching projects from group %s", group) details = gitlab.get_group_projects(group) if validate.api_result(details): info("[*] Found %s projects for group %s", len(details), group) for item in details: group_projects.update({item['id']: item['http_url_to_repo']}) return group_projects
def get_all(project_id, project_url): job_logs = [] info("[*] Retrieving job stats for project %s", project_url) jobs = gitlab.get_jobs(project_id) if validate.api_result(jobs): warning("[*] Found %s jobs for project %s", len(jobs), project_url) for job in jobs: info("[*] Retrieving job %s, which completed at %s", job['id'], job['finished_at']) job_log = gitlab.get_job_logs(project_id, job['id']) job_logs.append(types.JobLog(job['id'], job['web_url'], job_log)) return job_logs
def get_all(project_id, issue_id, issue_web_url): comments = [] detail = gitlab.get_issue_comments(project_id, issue_id) if validate.api_result(detail): for item in detail: legit_comments = 0 for note in item['notes']: if note['system']: # ignore system notes: https://docs.gitlab.com/ee/api/discussions.html continue comments.append( types.Comment('issue', issue_web_url, note['body'])) legit_comments += 1 if legit_comments > 0: warning("[*] Found %s comments for issue %s", legit_comments, issue_web_url) return comments
def project_details(project): info("[*] Fetching project details for %s", project) details = gitlab.get_project_details(project) if validate.api_result(details): warning("[*] Found project with name %s", details['name']) return details