Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Automate adding manifest to integTest notification cron" #5261

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions jenkins/integ-test-notification.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ pipeline {
timeout(time: 1, unit: 'HOURS')
buildDiscarder(logRotator(daysToKeepStr: '30'))
}
triggers {
parameterizedCron('''
H */6 * * * %INPUT_MANIFEST=1.3.21/opensearch-1.3.21.yml
H */6 * * * %INPUT_MANIFEST=2.19.0/opensearch-dashboards-2.19.0.yml
H */6 * * * %INPUT_MANIFEST=2.18.1/opensearch-2.18.1.yml
H */6 * * * %INPUT_MANIFEST=1.3.20/opensearch-dashboards-1.3.20.yml
H */6 * * * %INPUT_MANIFEST=2.19.0/opensearch-2.19.0.yml
H */6 * * * %INPUT_MANIFEST=2.18.0/opensearch-2.18.0.yml
H */6 * * * %INPUT_MANIFEST=2.18.0/opensearch-dashboards-2.18.0.yml
''')
}
parameters {
string(
name: 'INPUT_MANIFEST',
Expand Down
23 changes: 0 additions & 23 deletions src/manifests_workflow/input_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ def jenkins_path(self) -> str:
def cron_jenkinsfile(self) -> str:
return os.path.join(self.jenkins_path(), "check-for-build.jenkinsfile")

@classmethod
def cron_integTest_notification_jenkinsfile(self) -> str:
return os.path.join(self.jenkins_path(), "integ-test-notification.jenkinsfile")

@classmethod
def os_versionincrement_workflow(self) -> str:
return os.path.join(self.workflows_path(), "os-increment-plugin-versions.yml")
Expand Down Expand Up @@ -124,7 +120,6 @@ def update(
for new_version_entry in new_versions:
self.write_manifest(new_version_entry, branch_versions[new_version_entry], known_versions)
self.add_to_cron(new_version_entry)
self.add_to_integTest_notification_cron(new_version_entry)
self.add_to_versionincrement_workflow(new_version_entry)
known_versions.append(new_version_entry)

Expand Down Expand Up @@ -217,24 +212,6 @@ def add_to_cron(self, version: str) -> None:

logging.info(f"Wrote {jenkinsfile}")

def add_to_integTest_notification_cron(self, version: str) -> None:
logging.info(f"Adding new version to integ test notification cron: {version}")
integTestJenkinsfile = self.cron_integTest_notification_jenkinsfile()
with open(integTestJenkinsfile, "r") as f:
data = f.read()

cron_entry = f"H */6 * * * %INPUT_MANIFEST={version}/{self.prefix}-{version}.yml\n"

if cron_entry in data:
raise ValueError(f"{integTestJenkinsfile} already contains an entry for {self.prefix} {version}")

data = data.replace("parameterizedCron('''\n", f"parameterizedCron('''\n{' ' * 12}{cron_entry}")

with open(integTestJenkinsfile, "w") as f:
f.write(data)

logging.info(f"Wrote {integTestJenkinsfile}")

def add_to_versionincrement_workflow(self, version: str) -> None:
versionincrement_workflow_files = [self.os_versionincrement_workflow(), self.osd_versionincrement_workflow()]
yaml = ruamel.yaml.YAML()
Expand Down
17 changes: 0 additions & 17 deletions tests/tests_manifests_workflow/test_input_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,6 @@ def test_cron_jenkinsfile(self) -> None:
os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "jenkins", "check-for-build.jenkinsfile"))
)

def test_cron_integTest_notification_jenkinsfilee(self) -> None:
self.assertEqual(
InputManifests.cron_integTest_notification_jenkinsfile(),
os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "jenkins", "integ-test-notification.jenkinsfile"))
)

@patch("builtins.open", new_callable=mock_open)
def test_add_to_cron(self, mock_open: MagicMock) -> None:
mock_open().read.return_value = "parameterizedCron '''\n"
Expand All @@ -232,17 +226,6 @@ def test_add_to_cron(self, mock_open: MagicMock) -> None:
"TEST_MANIFEST=0.1.2/test-0.1.2-test.yml;TEST_PLATFORM=linux;TEST_DISTRIBUTION=tar\n"
)

@patch("builtins.open", new_callable=mock_open)
def test_add_to_integTest_notification_cron(self, mock_open: MagicMock) -> None:
mock_open().read.return_value = "parameterizedCron('''\n"
input_manifests = InputManifests("test")
input_manifests.add_to_integTest_notification_cron('0.1.2')
mock_open.assert_has_calls([call(InputManifests.cron_integTest_notification_jenkinsfile(), 'w')])
mock_open.assert_has_calls([call(InputManifests.cron_integTest_notification_jenkinsfile(), 'r')])
mock_open().write.assert_called_once_with(
"parameterizedCron('''\n H */6 * * * %INPUT_MANIFEST=0.1.2/test-0.1.2.yml\n"
)

def test_os_versionincrement_workflow(self) -> None:
self.assertEqual(
InputManifests.os_versionincrement_workflow(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ def test_files(self) -> None:
@patch("os.chdir")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_versionincrement_workflow")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_cron")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_integTest_notification_cron")
@patch("manifests.manifest.Manifest.to_file")
@patch("manifests_workflow.input_manifests_opensearch.ComponentOpenSearchMin")
def test_update(self, mock_component_opensearch_min: MagicMock, mock_manifest_to_file: MagicMock, mock_add_to_integTest_notification_cron: MagicMock,
def test_update(self, mock_component_opensearch_min: MagicMock, mock_manifest_to_file: MagicMock,
mock_add_to_cron: MagicMock, mock_add_to_versionincrement_workflow: MagicMock,
*mocks: MagicMock) -> None:
mock_component_opensearch_min.return_value = MagicMock(name="OpenSearch")
Expand All @@ -54,9 +53,6 @@ def test_update(self, mock_component_opensearch_min: MagicMock, mock_manifest_to
)
]
mock_manifest_to_file.assert_has_calls(calls)
mock_add_to_integTest_notification_cron.assert_has_calls([
call('2.1000.1000'),
])
mock_add_to_cron.assert_has_calls([
call('2.1000.1000'),
])
Expand All @@ -66,10 +62,9 @@ def test_update(self, mock_component_opensearch_min: MagicMock, mock_manifest_to

@patch("manifests_workflow.input_manifests.InputManifests.add_to_versionincrement_workflow")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_cron")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_integTest_notification_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_integTest_notification_cron: MagicMock,
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"]
Expand All @@ -78,5 +73,4 @@ def test_update_outdated_branch(self, mock_component_opensearch_min: MagicMock,
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_integTest_notification_cron.call_count, 0)
self.assertEqual(mock_add_to_versionincrement_workflow.call_count, 0)
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ def test_files(self) -> None:
@patch("os.chdir")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_versionincrement_workflow")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_cron")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_integTest_notification_cron")
@patch("manifests.manifest.Manifest.to_file")
@patch("manifests_workflow.input_manifests_opensearch_dashboards.ComponentOpenSearchDashboardsMin")
def test_update(self, mock_component_opensearch_dashboards_min: MagicMock, mock_manifest_to_file: MagicMock, mock_add_to_integTest_notification_cron: MagicMock,
def test_update(self, mock_component_opensearch_dashboards_min: MagicMock, mock_manifest_to_file: MagicMock,
mock_add_to_cron: MagicMock, mock_add_to_versionincrement_workflow: MagicMock,
mock_os_chdir: MagicMock, mock_os_makedirs: MagicMock) -> None:
mock_component_opensearch_dashboards_min.return_value = MagicMock(name="OpenSearch-Dashboards")
Expand All @@ -58,19 +57,15 @@ def test_update(self, mock_component_opensearch_dashboards_min: MagicMock, mock_
mock_add_to_cron.assert_has_calls([
call('2.1000.1000')
])
mock_add_to_integTest_notification_cron.assert_has_calls([
call('2.1000.1000')
])
mock_add_to_versionincrement_workflow.assert_has_calls([
call('2.1000.1000')
])

@patch("manifests_workflow.input_manifests.InputManifests.add_to_versionincrement_workflow")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_cron")
@patch("manifests_workflow.input_manifests.InputManifests.add_to_integTest_notification_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_integTest_notification_cron: MagicMock,
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"]
Expand All @@ -80,5 +75,4 @@ def test_update_outdated_branch(self, mock_component_opensearch_dashboards_min:
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_integTest_notification_cron.call_count, 0)
self.assertEqual(mock_add_to_versionincrement_workflow.call_count, 0)
Loading