def get_impacts_from_url(regression_range, job_type, platform=None): """Gets impact string using the build information url.""" component_name = data_handler.get_component_name(job_type) if component_name: return get_component_impacts_from_url(component_name, regression_range, job_type, platform) start_revision, end_revision = get_start_and_end_revision( regression_range, job_type) if not end_revision: return Impacts() build_revision_mappings = revisions.get_build_to_revision_mappings(platform) if not build_revision_mappings: return Impacts() extended_stable = get_impact( build_revision_mappings.get('extended_stable'), start_revision, end_revision) stable = get_impact( build_revision_mappings.get('stable'), start_revision, end_revision) beta = get_impact( build_revision_mappings.get('beta'), start_revision, end_revision) return Impacts(stable, beta, extended_stable)
def get_impacts_from_url(regression_range, job_type, platform=None): """Gets impact string using the build information url.""" # FIXME: We can't handle component builds atm. if data_handler.get_component_name(job_type): return Impacts() start_revision, end_revision = get_start_and_end_revision( regression_range, job_type) if not end_revision: return Impacts() build_revision_mappings = revisions.get_build_to_revision_mappings(platform) if not build_revision_mappings: return Impacts() stable = get_impact( build_revision_mappings.get('stable'), start_revision, end_revision) beta = get_impact( build_revision_mappings.get('beta'), start_revision, end_revision) return Impacts(stable, beta)
def update_issue_impact_labels(testcase, issue): """Update impact labels on issue.""" if testcase.one_time_crasher_flag: return if data_handler.get_component_name(testcase.job_type): # Component builds are not supported. return existing_impact = _get_impact_from_labels(issue.labels) if testcase.regression.startswith('0:'): # If the regression range starts from the start of time, # then we assume that the bug impacts stable. new_impact = data_types.SecurityImpact.STABLE elif testcase.is_impact_set_flag: # Add impact label based on testcase's impact value. if testcase.impact_stable_version: new_impact = data_types.SecurityImpact.STABLE elif testcase.impact_beta_version: new_impact = data_types.SecurityImpact.BETA else: new_impact = data_types.SecurityImpact.HEAD else: # No impact information. return if existing_impact == new_impact: # Correct impact already set. return if existing_impact != data_types.SecurityImpact.MISSING: issue.labels.remove('Security_Impact-' + impact_to_string(existing_impact)) issue.labels.add('Security_Impact-' + impact_to_string(new_impact))
def get_component_revisions_dict(revision, job_type): """Retrieve revision vars dict.""" if revision == 0 or revision == '0' or revision is None: # Return empty dict for zero start revision. return {} config = db_config.get() revision_info_url_format = db_config.get_value_for_job( config.revision_vars_url, job_type) if not revision_info_url_format: return None project_name = data_handler.get_project_name(job_type) revisions_dict = {} if utils.is_chromium(): component = data_handler.get_component_name(job_type) repository = data_handler.get_repository_for_component(component) if repository and not _is_clank(revision_info_url_format): revision_hash = _git_commit_position_to_git_hash_for_chromium( revision, repository) if revision_hash is None: return None # FIXME: While we check for this explicitly appended component in all # applicable cases that we know of within this codebase, if the dict # is shared with an external service (e.g. Predator) we may need to clean # this up beforehand. revisions_dict['/src'] = { 'name': _get_component_display_name(component, project_name), 'url': _git_url_for_chromium_repository(repository), 'rev': revision_hash, 'commit_pos': revision } # Use revision hash for info url later. revision = revision_hash revision_info_url = revision_info_url_format % revision url_content = _get_url_content(revision_info_url) if not url_content: logs.log_error('Failed to get component revisions from %s.' % revision_info_url) return None # Parse as per DEPS format. if _is_deps(revision_info_url): deps_revisions_dict = deps_to_revisions_dict(url_content) if not deps_revisions_dict: return None revisions_dict.update(deps_revisions_dict) return revisions_dict # Parse as per Clank DEPS format. if _is_clank(revision_info_url): return _clank_revision_file_to_revisions_dict(url_content) # Default case: parse content as yaml. revisions_dict = _to_dict(url_content) if not revisions_dict: logs.log_error('Failed to parse component revisions from %s.' % revision_info_url) return None # Parse as per source map format. if revision_info_url.endswith(SOURCE_MAP_EXTENSION): revisions_dict = _src_map_to_revisions_dict(revisions_dict, project_name) return revisions_dict