forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_check_list_dist.py
31 lines (24 loc) · 1.08 KB
/
ci_check_list_dist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright OpenSearch Contributors
# 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.
from typing import Any
from ci_workflow.ci_check_list import CiCheckList
from ci_workflow.ci_check_manifest_component import CiCheckManifestComponent
class CiCheckListDist(CiCheckList):
def checkout(self, work_dir: str) -> None:
pass
CHECKS = {"manifest:component": CiCheckManifestComponent}
class InvalidCheckError(Exception):
def __init__(self, check: Any) -> None:
self.check = check
super().__init__(f"Invalid check: {check.name}, must be one of {CiCheckListDist.CHECKS.keys()}.")
def check(self) -> None:
for check in self.component.checks:
klass = CiCheckListDist.CHECKS.get(check.name, None)
if klass is None:
raise CiCheckListDist.InvalidCheckError(check)
instance = klass(self.component, self.target, check.args)
instance.check()