From 7360119d2ab47d88f940687da7eca8412523475f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Tue, 7 Nov 2023 16:37:47 +0100 Subject: [PATCH] chore(dependency_checker): only inform about missing versions --- ci/check_dependencies/common.py | 15 ++++++++++++--- ci/check_dependencies/kops.py | 30 ++++-------------------------- ci/check_dependencies/main.py | 9 --------- 3 files changed, 16 insertions(+), 38 deletions(-) diff --git a/ci/check_dependencies/common.py b/ci/check_dependencies/common.py index 7ca6a92fc8..869642c03b 100644 --- a/ci/check_dependencies/common.py +++ b/ci/check_dependencies/common.py @@ -48,6 +48,15 @@ def get_info(platform, officially_supported): else: line_pattern = "K8s with {}".format(platform) + now_suppported = kubernetes_collection.get_supported_versions(line_pattern) + versions_to_add = sorted(set(officially_supported) - set(now_suppported)) + versions_to_remove = sorted(set(now_suppported) - set(officially_supported)) + + if len(versions_to_add) == 0 and len(versions_to_remove) == 0: + return + + print(f"") + print(f"#### {platform} ####") print("{} officially supported versions".format(platform)) print(officially_supported) @@ -56,16 +65,16 @@ def get_info(platform, officially_supported): platform ) ) - now_suppported = kubernetes_collection.get_supported_versions(line_pattern) + print(now_suppported) print("\n") - versions_to_add = sorted(set(officially_supported) - set(now_suppported)) + if len(versions_to_add) != 0: print("Please add support to following {} versions:".format(platform)) print(versions_to_add) - versions_to_remove = sorted(set(now_suppported) - set(officially_supported)) + if len(versions_to_remove) != 0: print("Please remove support to following {} versions:".format(platform)) print(versions_to_remove) diff --git a/ci/check_dependencies/kops.py b/ci/check_dependencies/kops.py index 0b8f83ddcd..571776fff7 100644 --- a/ci/check_dependencies/kops.py +++ b/ci/check_dependencies/kops.py @@ -3,6 +3,7 @@ import os import json import kubernetes_collection +import common kops_line_pattern = "K8s with Kops" @@ -46,30 +47,7 @@ def get_expected_supported_kops(kops_releases): def get_info(): - print("kOps latest versions from https://github.com/kubernetes/kops/releases") + # Figure out which versions we need to add/remove kops_minor_releases = get_minor_releases("kubernetes", "kops") - print(kops_minor_releases) - - print( - "Currently supported kOps versions for Sumologic Kubernetes Collection Helm Chart" - ) - kops_now_suppported = kubernetes_collection.get_supported_versions( - kops_line_pattern - ) - print(kops_now_suppported) - - print( - "Expected supported kOps versions for Sumologic Kubernetes Collection Helm Chart" - ) - kops_expected_supported = get_expected_supported_kops(kops_minor_releases) - print(kops_expected_supported) - - versions_to_add = sorted(set(kops_expected_supported) - set(kops_now_suppported)) - if len(versions_to_add) != 0: - print("\nPlease add support to following kOps versions:") - print(versions_to_add) - - versions_to_remove = sorted(set(kops_now_suppported) - set(kops_expected_supported)) - if len(versions_to_remove) != 0: - print("Please remove support to following kOps versions:") - print(versions_to_remove) + officially_supported = get_expected_supported_kops(kops_minor_releases) + common.get_info("Kops", officially_supported) \ No newline at end of file diff --git a/ci/check_dependencies/main.py b/ci/check_dependencies/main.py index 826bdba0c2..e95df6418c 100644 --- a/ci/check_dependencies/main.py +++ b/ci/check_dependencies/main.py @@ -9,19 +9,10 @@ if __name__ == "__main__": print("Gardener helper") print("#####################################################################\n") - print("#### kOps ####") kops.get_info() - print("") - print("#### EKS ####") eks.get_info() - print("") - print("#### GKE ####") gke.get_info() - print("") - print("#### AKS ####") aks.get_info() - print("") - print("#### OpenShift ####") openshift.get_info() print("")