diff --git a/lib/http_requests.py b/lib/http_requests.py index 0273984..0770311 100644 --- a/lib/http_requests.py +++ b/lib/http_requests.py @@ -126,7 +126,7 @@ def process_version_advisories(version, yml_data, seen): def get_advisories(branch_name): """ Gets the list of advisories from the releases.yml file of an OpenShift release. - Filters out releases with 'custom' assembly type. + Filters out releases with 'custom' assembly type or empty advisories. :param branch_name: OpenShift branch name in ocp-build-data. eg: openshift-4.10 :returns: List of lists containing the advisories with the z-stream version. Eg: [['4.11.6', {'extras': 102175, 'image': 102174, 'metadata': 102177, 'rpm': 102173}], ... ] @@ -157,21 +157,33 @@ def get_advisories(branch_name): if not current_advisories: current_advisories = {} + override_applied = False while depth < MAX_DEPTH: depth += 1 basis_version = yml_data[current_version].get('assembly', {}).get('basis', {}).get('assembly') if not basis_version or basis_version in seen: break + # Check for 'advisories!' override in basis version + basis_override_advisories = yml_data[basis_version].get('assembly', {}).get('group', {}).get('advisories!', None) + if basis_override_advisories is not None: + if not basis_override_advisories: # If basis version's override_advisories is empty + current_advisories.clear() + break # No need to process further as the advisories are cleared + current_advisories.update(basis_override_advisories) + basis_advisories, _ = process_version_advisories(basis_version, yml_data, seen) if basis_advisories: current_advisories.update(basis_advisories) current_version = basis_version - # Apply override advisories specified with 'advisories!' - override_advisories = yml_data[version].get('assembly', {}).get('group', {}).get('advisories!', {}) - if override_advisories: - current_advisories.update(override_advisories) + # Check for 'advisories!' override in the current version if not applied from basis + if not override_applied: + current_override_advisories = assembly_data.get('group', {}).get('advisories!', None) + if current_override_advisories is not None: + if not current_override_advisories: + continue + current_advisories.update(current_override_advisories) if current_advisories: advisory_data.append([version, current_advisories, jira_link])