-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
require test manifest path for running tests (#1229)
* require test manifest path for running tests Signed-off-by: Tianle Huang <tianleh@amazon.com> * fix style Signed-off-by: Tianle Huang <tianleh@amazon.com> * fix the CI manifest checks Signed-off-by: Tianle Huang <tianleh@amazon.com> * address comments Signed-off-by: Tianle Huang <tianleh@amazon.com> * update README.md Signed-off-by: Tianle Huang <tianleh@amazon.com> * address feedback Signed-off-by: Tianle Huang <tianleh@amazon.com> * fix import Signed-off-by: Tianle Huang <tianleh@amazon.com> * refactor CI manifests Signed-off-by: Tianle Huang <tianleh@amazon.com> * update readme Signed-off-by: Tianle Huang <tianleh@amazon.com> * more docs Signed-off-by: Tianle Huang <tianleh@amazon.com> * remove type Signed-off-by: Tianle Huang <tianleh@amazon.com>
- Loading branch information
Showing
17 changed files
with
171 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
import logging | ||
|
||
from ci_workflow.ci_check_lists import CiCheckLists | ||
from ci_workflow.ci_manifest import CiManifest | ||
from ci_workflow.ci_target import CiTarget | ||
from manifests.input_manifest import InputManifest | ||
from system.temporary_directory import TemporaryDirectory | ||
|
||
|
||
class CiInputManifest(CiManifest): | ||
def __init__(self, file, args): | ||
super().__init__(InputManifest.from_file(file), args) | ||
|
||
def __check__(self): | ||
|
||
target = CiTarget(version=self.manifest.build.version, snapshot=self.args.snapshot) | ||
|
||
with TemporaryDirectory(keep=self.args.keep, chdir=True) as work_dir: | ||
logging.info(f"Sanity-testing in {work_dir.name}") | ||
|
||
logging.info(f"Sanity testing {self.manifest.build.name}") | ||
|
||
for component in self.manifest.components.select(focus=self.args.component): | ||
logging.info(f"Sanity testing {component.name}") | ||
|
||
ci_check_list = CiCheckLists.from_component(component, target) | ||
ci_check_list.checkout(work_dir.name) | ||
ci_check_list.check() | ||
logging.info("Done.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
import abc | ||
import logging | ||
|
||
|
||
class CiManifest(abc.ABC): | ||
def __init__(self, manifest, args): | ||
self.manifest = manifest | ||
self.args = args | ||
|
||
def check(self): | ||
try: | ||
self.__check__() | ||
except: | ||
logging.error("CI Manifest check failed") | ||
raise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
|
||
import re | ||
|
||
from ci_workflow.ci_input_manifest import CiInputManifest | ||
from ci_workflow.ci_test_manifest import CiTestManifest | ||
|
||
|
||
class CiManifests: | ||
def __klass(filename): | ||
if re.search("-test.yml$", filename): | ||
return CiTestManifest | ||
else: | ||
return CiInputManifest | ||
|
||
@classmethod | ||
def from_file(cls, file, args): | ||
return cls.__klass(file.name)(file, args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
|
||
import logging | ||
|
||
from ci_workflow.ci_manifest import CiManifest | ||
from manifests.test_manifest import TestManifest | ||
|
||
|
||
class CiTestManifest(CiManifest): | ||
def __init__(self, file, args): | ||
super().__init__(TestManifest.from_file(file), args) | ||
|
||
def __check__(self): | ||
assert self.manifest | ||
logging.info("TestManifest schema validation succeeded") | ||
logging.info("Done.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.