diff --git a/src/manifests_workflow/input_manifests.py b/src/manifests_workflow/input_manifests.py index 528af687e2..1b68a1f4da 100644 --- a/src/manifests_workflow/input_manifests.py +++ b/src/manifests_workflow/input_manifests.py @@ -91,10 +91,16 @@ def update( with TemporaryDirectory(keep=keep, chdir=True) as work_dir: logging.info(f"Checking out components into {work_dir.name}") - # check out and build #main, 1.x, etc. - branches = sorted(min_klass.branches()) + outdated_branches = ["1.0", "1.1", "1.2"] + # check out and build #main, 1.x, etc. + # ignore branches that are outdated and not maintained anymore + # ex: 1.0 failed due to certain dependencies not available anymore: https://github.com/avast/gradle-docker-compose-plugin/issues/446 + all_branches = sorted(min_klass.branches()) + branches = [b for b in all_branches if not any(b.startswith(o) for o in outdated_branches)] logging.info(f"Checking {self.name} {branches} branches") + logging.info(f"Ignoring {self.name} {sorted(set(all_branches) - set(branches))} branches as they are outdated") + for branch in branches: min_component_klass = min_klass.checkout( path=os.path.join(work_dir.name, self.name.replace(" ", ""), branch), diff --git a/tests/tests_manifests_workflow/test_input_manifests_opensearch.py b/tests/tests_manifests_workflow/test_input_manifests_opensearch.py index bbfc15b5d1..3bbfdf8e65 100644 --- a/tests/tests_manifests_workflow/test_input_manifests_opensearch.py +++ b/tests/tests_manifests_workflow/test_input_manifests_opensearch.py @@ -59,3 +59,18 @@ def test_update(self, mock_component_opensearch_min: MagicMock, mock_manifest_to mock_add_to_versionincrement_workflow.assert_has_calls([ call('2.12.1000'), ]) + + @patch("manifests_workflow.input_manifests.InputManifests.add_to_versionincrement_workflow") + @patch("manifests_workflow.input_manifests.InputManifests.add_to_cron") + @patch("manifests.manifest.Manifest.to_file") + @patch("manifests_workflow.input_manifests_opensearch.ComponentOpenSearchMin") + def test_update_outdated_branch(self, mock_component_opensearch_min: MagicMock, mock_manifest_to_file: MagicMock, + mock_add_to_cron: MagicMock, mock_add_to_versionincrement_workflow: MagicMock) -> None: + mock_component_opensearch_min.return_value = MagicMock(name="OpenSearch") + mock_component_opensearch_min.branches.return_value = ["1.2"] + mock_component_opensearch_min.checkout.return_value = MagicMock(version="1.2.1000") + manifests = InputManifestsOpenSearch() + manifests.update() + self.assertEqual(mock_manifest_to_file.call_count, 0) + self.assertEqual(mock_add_to_cron.call_count, 0) + self.assertEqual(mock_add_to_versionincrement_workflow.call_count, 0) diff --git a/tests/tests_manifests_workflow/test_input_manifests_opensearch_dashboards.py b/tests/tests_manifests_workflow/test_input_manifests_opensearch_dashboards.py index 0f8a466618..9273675882 100644 --- a/tests/tests_manifests_workflow/test_input_manifests_opensearch_dashboards.py +++ b/tests/tests_manifests_workflow/test_input_manifests_opensearch_dashboards.py @@ -60,3 +60,19 @@ def test_update(self, mock_component_opensearch_dashboards_min: MagicMock, mock_ mock_add_to_versionincrement_workflow.assert_has_calls([ call('2.12.1000') ]) + + @patch("manifests_workflow.input_manifests.InputManifests.add_to_versionincrement_workflow") + @patch("manifests_workflow.input_manifests.InputManifests.add_to_cron") + @patch("manifests.manifest.Manifest.to_file") + @patch("manifests_workflow.input_manifests_opensearch_dashboards.ComponentOpenSearchDashboardsMin") + def test_update_outdated_branch(self, mock_component_opensearch_dashboards_min: MagicMock, mock_manifest_to_file: MagicMock, + mock_add_to_cron: MagicMock, mock_add_to_versionincrement_workflow: MagicMock) -> None: + mock_component_opensearch_dashboards_min.return_value = MagicMock(name="OpenSearch-Dashboards") + mock_component_opensearch_dashboards_min.branches.return_value = ["1.2"] + mock_component_opensearch_dashboards_min.checkout.return_value = MagicMock(version="1.2.1000") + + manifests = InputManifestsOpenSearchDashboards() + manifests.update() + self.assertEqual(mock_manifest_to_file.call_count, 0) + self.assertEqual(mock_add_to_cron.call_count, 0) + self.assertEqual(mock_add_to_versionincrement_workflow.call_count, 0)