Skip to content

Commit

Permalink
Merge branch 'main' into add-yamllint-ci
Browse files Browse the repository at this point in the history
Signed-off-by: Rupa Lahiri <[email protected]>
  • Loading branch information
rblcoder committed Oct 5, 2023
2 parents 98cf385 + 71ccd7b commit 21dd1d7
Show file tree
Hide file tree
Showing 27 changed files with 995 additions and 401 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ out.txt

/manifests/**/*.yml.lock
vars/

test-report.yml
2 changes: 2 additions & 0 deletions jenkins/opensearch-dashboards/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ pipeline {
testType: "integ-test",
componentName: "${COMPONENT_NAME}",
)
echo("Download report manifest from https://ci.opensearch.org/ci/dbc/integ-test/${env.version}/${env.buildId}/${env.platform}/${env.architecture}/${env.distribution}/test-results/${env.BUILD_NUMBER}/integ-test/test-report.yml")
archiveArtifacts artifacts: 'test-report.yml'
}
}
}
Expand Down
119 changes: 46 additions & 73 deletions jenkins/opensearch/benchmark-test.jenkinsfile

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions jenkins/opensearch/integ-test.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ pipeline {
testType: "integ-test",
componentName: "${COMPONENT_NAME}",
)
echo("Download report manifest from https://ci.opensearch.org/ci/dbc/integ-test/${env.version}/${env.buildId}/${env.platform}/${env.architecture}/${env.distribution}/test-results/${env.BUILD_NUMBER}/integ-test/test-report.yml")
archiveArtifacts artifacts: 'test-report.yml'
}
}
}
Expand Down
143 changes: 143 additions & 0 deletions manifests/2.11.0/opensearch-2.11.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,95 @@ components:
checks:
- gradle:publish
- gradle:properties:version
- name: common-utils
repository: https://github.com/opensearch-project/common-utils.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:publish
- gradle:properties:version
- name: job-scheduler
repository: https://github.com/opensearch-project/job-scheduler.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
- name: k-NN
repository: https://github.com/opensearch-project/k-NN.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
- name: geospatial
repository: https://github.com/opensearch-project/geospatial.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
- name: security
repository: https://github.com/opensearch-project/security.git
ref: 2.x
platforms:
- linux
- windows
- name: cross-cluster-replication
repository: https://github.com/opensearch-project/cross-cluster-replication.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
- name: ml-commons
repository: https://github.com/opensearch-project/ml-commons.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version: opensearch-ml-plugin
- name: neural-search
repository: https://github.com/opensearch-project/neural-search.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
- name: notifications-core
repository: https://github.com/opensearch-project/notifications.git
ref: 2.x
platforms:
- linux
- windows
working_directory: notifications
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version: opensearch-notifications-core
- name: notifications
repository: https://github.com/opensearch-project/notifications.git
ref: 2.x
platforms:
- linux
- windows
working_directory: notifications
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version: notifications
- name: opensearch-observability
repository: https://github.com/opensearch-project/observability.git
ref: 2.x
Expand Down Expand Up @@ -47,3 +130,63 @@ components:
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version: opensearch-sql-plugin
- name: asynchronous-search
repository: https://github.com/opensearch-project/asynchronous-search.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
- name: anomaly-detection
repository: https://github.com/opensearch-project/anomaly-detection.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
- name: alerting
repository: https://github.com/opensearch-project/alerting.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version: alerting
- name: security-analytics
repository: https://github.com/opensearch-project/security-analytics.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- name: index-management
repository: https://github.com/opensearch-project/index-management.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- name: performance-analyzer
repository: https://github.com/opensearch-project/performance-analyzer.git
ref: 2.x
platforms:
- linux
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
- name: custom-codecs
repository: https://github.com/opensearch-project/custom-codecs.git
ref: 2.x
platforms:
- linux
- windows
checks:
- gradle:properties:version
- gradle:dependencies:opensearch.version
31 changes: 29 additions & 2 deletions manifests/2.11.0/opensearch-dashboards-2.11.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ components:
- name: OpenSearch-Dashboards
repository: https://github.com/opensearch-project/OpenSearch-Dashboards.git
ref: 2.x
- name: securityDashboards
repository: https://github.com/opensearch-project/security-dashboards-plugin.git
- name: functionalTestDashboards
repository: https://github.com/opensearch-project/opensearch-dashboards-functional-test.git
ref: 2.x
- name: observabilityDashboards
repository: https://github.com/opensearch-project/dashboards-observability.git
Expand All @@ -26,3 +26,30 @@ components:
- name: queryWorkbenchDashboards
repository: https://github.com/opensearch-project/dashboards-query-workbench.git
ref: 2.x
- name: customImportMapDashboards
repository: https://github.com/opensearch-project/dashboards-maps.git
ref: 2.x
- name: anomalyDetectionDashboards
repository: https://github.com/opensearch-project/anomaly-detection-dashboards-plugin
ref: 2.x
- name: mlCommonsDashboards
repository: https://github.com/opensearch-project/ml-commons-dashboards.git
ref: 2.x
- name: indexManagementDashboards
repository: https://github.com/opensearch-project/index-management-dashboards-plugin.git
ref: 2.x
- name: notificationsDashboards
repository: https://github.com/opensearch-project/dashboards-notifications.git
ref: 2.x
- name: alertingDashboards
repository: https://github.com/opensearch-project/alerting-dashboards-plugin.git
ref: 2.x
- name: securityAnalyticsDashboards
repository: https://github.com/opensearch-project/security-analytics-dashboards-plugin.git
ref: 2.x
- name: securityDashboards
repository: https://github.com/opensearch-project/security-dashboards-plugin.git
ref: 2.x
- name: searchRelevanceDashboards
repository: https://github.com/opensearch-project/dashboards-search-relevance.git
ref: 2.x
3 changes: 2 additions & 1 deletion src/report_workflow/test_report_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def update_data(self) -> dict:
self.test_run_data["name"] = self.product_name
self.test_run_data["test-run"] = self.update_test_run_data()
for component in self.test_components.select(focus=self.args.components):
self.test_run_data["components"].append(self.component_entry(component.name))
if self.test_manifest.components[component.name].__to_dict__().get(self.test_type) is not None:
self.test_run_data["components"].append(self.component_entry(component.name))
return self.test_run_data

def update_test_run_data(self) -> dict:
Expand Down
22 changes: 11 additions & 11 deletions src/validation_workflow/api_test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from typing import Any

from validation_workflow.api_request import ApiTest
from validation_workflow.validation_args import ValidationArgs

'''
This class is the collection of test cases to run.
Expand All @@ -19,24 +18,25 @@
class ApiTestCases:

def __init__(self) -> None:
self.opensearch_image_version = ValidationArgs().stg_tag('opensearch').split(' ')[0]
self.opensearch_dashboards_image_version = ValidationArgs().stg_tag('opensearch_dashboards').split(' ')[0]
pass

def test_cases(self) -> Any:
@staticmethod
def test_apis(projects: list) -> Any:
pass_counter, fail_counter = 0, 0

# the test case parameters are formated as ['<request_url>',<success_status_code>,'<validate_string(optional)>']
test_cases = [
['https://localhost:9200/', 200, '"number" : "' + self.opensearch_image_version + '"'],
test_apis = [
['https://localhost:9200/', 200, ''],
['https://localhost:9200/_cat/plugins?v', 200, ''],
['https://localhost:9200/_cat/health?v', 200, 'green'],
['http://localhost:5601/api/status', 200, '"number":"' + self.opensearch_dashboards_image_version + '"']
]
if ("opensearch-dashboards" in projects):
test_apis.append(['http://localhost:5601/api/status', 200, ''])

for test_case in test_cases:
request_url = test_case.__getitem__(0)
success_status_code = test_case.__getitem__(1)
validate_string = test_case.__getitem__(2)
for test_api in test_apis:
request_url = test_api.__getitem__(0)
success_status_code = test_api.__getitem__(1)
validate_string = test_api.__getitem__(2)

status_code, response_text = ApiTest(str(request_url)).api_get()
logging.info(f"\nRequest_url ->{str(request_url)} \n")
Expand Down
29 changes: 13 additions & 16 deletions src/validation_workflow/docker/validation_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def download_artifacts(self) -> bool:
assert self.is_container_daemon_running(), 'Docker daemon is not running. Exiting the docker validation.'

# STEP 1 . pull the images for OS and OSD
product_names = ["opensearch", "opensearch_dashboards"]
product_names = self.args.projects
using_staging_artifact_only = 'staging' if self.args.using_staging_artifact_only else 'production'
get_image_id = lambda product: self.get_image_id( # noqa: E731
self.get_artifact_image_name(product, using_staging_artifact_only),
self.args.version if not self.args.using_staging_artifact_only else ValidationArgs().stg_tag(product).replace(" ", ""))
self.image_ids = list(map(get_image_id, product_names))
logging.info(f'the opensearch image ID is : {self.image_ids[0]}')
logging.info(f'the opensearch-dashboards image ID is : {self.image_ids[1]} \n\n')
self.image_ids = {key: value for key, value in zip(product_names, list(map(get_image_id, product_names)))}
self.image_ids = {key: value.strip() for key, value in self.image_ids.items()}

return True

except AssertionError as e:
Expand All @@ -62,8 +62,8 @@ def validation(self) -> bool:
# STEP 2 . inspect image digest between opensearchproject(downloaded/local) and opensearchstaging(dockerHub)
if not self.args.using_staging_artifact_only:
self.image_names_list = [self.args.OS_image, self.args.OSD_image]
self.image_digests = list(map(lambda x: self.inspect_docker_image(x[0], x[1]), zip(self.image_ids, self.image_names_list))) # type: ignore

self.image_names_list = [x for x in self.image_names_list if (os.path.basename(x) in self.args.projects)]
self.image_digests = list(map(lambda x: self.inspect_docker_image(x[0], x[1]), zip(self.image_ids.values(), self.image_names_list))) # type: ignore
if all(self.image_digests):
logging.info('Image digest is validated.\n\n')
if self.args.validate_digest_only:
Expand All @@ -75,16 +75,15 @@ def validation(self) -> bool:
# STEP 3 . spin-up OS/OSD cluster
if not self.args.validate_digest_only:
return_code, self._target_yml_file = self.run_container(
self.image_ids[0],
self.image_ids[1],
self.image_ids,
self.args.version
)
if return_code:
logging.info('Checking if cluster is ready for API test in every 10 seconds\n\n')

if self.check_cluster_readiness():
# STEP 4 . OS, OSD API validation
_test_result, _counter = ApiTestCases().test_cases()
_test_result, _counter = ApiTestCases().test_apis(self.args.projects)

if _test_result:
logging.info(f'All tests Pass : {_counter}')
Expand Down Expand Up @@ -167,7 +166,7 @@ def get_artifact_image_name(self, artifact: str, using_staging_artifact_only: st
'staging': 'opensearchstaging/opensearch',
'production': 'opensearchproject/opensearch'
},
'opensearch_dashboards': {
'opensearch-dashboards': {
'staging': 'opensearchstaging/opensearch-dashboards',
'production': 'opensearchproject/opensearch-dashboards'
}
Expand All @@ -177,7 +176,7 @@ def get_artifact_image_name(self, artifact: str, using_staging_artifact_only: st
'staging': 'public.ecr.aws/opensearchstaging/opensearch',
'production': 'public.ecr.aws/opensearchproject/opensearch'
},
'opensearch_dashboards': {
'opensearch-dashboards': {
'staging': 'public.ecr.aws/opensearchstaging/opensearch-dashboards',
'production': 'public.ecr.aws/opensearchproject/opensearch-dashboards'
}
Expand Down Expand Up @@ -236,7 +235,7 @@ def pull_image(self, image_name: str, image_version: str) -> str:
else:
raise Exception(f'error on pulling image : return code {str(result_pull.returncode)}')

def run_container(self, OpenSearch_image_id: str, OpenSearchDashboard_image_id: str, version: str) -> Any:
def run_container(self, image_ids: dict, version: str) -> Any:
self.docker_compose_files = {
'1': 'docker-compose-1.x.yml',
'2': 'docker-compose-2.x.yml'
Expand All @@ -250,10 +249,8 @@ def run_container(self, OpenSearch_image_id: str, OpenSearchDashboard_image_id:
self.source_file = os.path.join('docker', 'release', 'dockercomposefiles', self.docker_compose_files[self.major_version_number])
shutil.copy2(self.source_file, self.target_yml_file)

self.replacements = [
(f'opensearchproject/opensearch:{self.major_version_number}', f'{OpenSearch_image_id}'),
(f'opensearchproject/opensearch-dashboards:{self.major_version_number}', f'{OpenSearchDashboard_image_id}')
]
self.replacements = [(f'opensearchproject/{key}:{self.major_version_number}', value) for key, value in image_ids.items()]

list(map(lambda r: self.inplace_change(self.target_yml_file, r[0], r[1]), self.replacements))

# spin up containers
Expand Down
2 changes: 1 addition & 1 deletion src/validation_workflow/download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DownloadUtils:
@staticmethod
def is_url_valid(url: str) -> bool:
response = requests.head(url)
status = bool(response.status_code == 200)
status = bool(response.status_code in [200, 302])
return status

@staticmethod
Expand Down
Loading

0 comments on commit 21dd1d7

Please sign in to comment.